Decoding with storage of less bits for less important data

ABSTRACT

A method and apparatus for performing compression and/or decompression is described. In one embodiment, the present invention comprises a system having a buffer, a wavelet transform unit, and a coder. The wavelet transform unit has an input coupled to the buffer to perform a wavelet transform on pixels stored therein and to generate coefficients at an output. The coder is coupled to the wavelet transform unit to code the transformed pixels received from the buffer.

This application is a divisional of application Ser. No. 09/435,313, nowU.S. Pat. No. 6,549,666, entitled “Reversible Embedded Wavelet SystemImplementation”, filed Nov. 5, 1999, which is a divisional ofapplication Ser. No. 08/847,074, abandoned, entitled “ReversibleEmbedded Wavelet System Implementation”, filed May 1, 1997, which is acontinuation-in-part of application Ser. No. 08/643,268, now U.S. Pat.No. 5,966,465, entitled “Compression/Decompression Using ReversibleEmbedded Wavelets”, filed May 3, 1996, which is a continuation-in-partof application Ser. No. 08/498,036, now U.S. Pat. No. 5,867,602,entitled “Reversible Wavelet Transform and Embedded CodestreamManipulation”, filed Jun. 30, 1995, which is a continuation-in-part ofapplication Ser. No. 08/310,146, now U.S. Pat. No. 5,748,786, entitled“Apparatus for Compression Using Reversible Embedded Wavelets”, filedSep. 21, 1994.

FIELD OF THE INVENTION

The present invention relates to the field of data compression anddecompression systems; particularly, the present invention relates to amethod and apparatus for lossless and lossy encoding and decoding ofdata in compression/decompression systems.

BACKGROUND OF THE INVENTION

Data compression is an extremely useful tool for storing andtransmitting large amounts of data. For example, the time required totransmit an image, such as a facsimile transmission of a document, isreduced drastically when compression is used to decrease the number ofbits required to recreate the image.

Many different data compression techniques exist in the prior art.Compression techniques can be divided into two broad categories, lossycoding and lossless coding. Lossy coding involves coding that results inthe loss of information, such that there is no guarantee of perfectreconstruction of the original data. The goal of lossy compression isthat changes to the original data are done in such a way that they arenot objectionable or detectable. In lossless compression, all theinformation is retained and the data is compressed in a manner whichallows for perfect reconstruction.

In lossless compression, input symbols or intensity data are convertedto output codewords. The input may include image, audio, one-dimensional(e.g., data changing spatially or temporally), two-dimensional (e.g.,data changing in two spatial directions (or one spatial and one temporaldimension)), or multi.-dimensional/multi-spectral data. If thecompression is successful, the codewords are represented in fewer bitsthan the number of bits required for the uncoded input symbols (orintensity data). Lossless coding methods include dictionary methods ofcoding (e.g., Lempel-Ziv), run length encoding, enumerative coding andentropy coding. In lossless image compression, compression is based onpredictions or contexts, plus coding. The JBIG standard for facsimilecompression (ISO/IEC 11544) and DPCM (differential pulse codemodulation—an option in the JPEG standard (ISO/IEC 10918)) forcontinuous-tone images are examples of lossless compression for images.In lossy compression, input symbols or intensity data are quantizedprior to conversion to output codewords. Quantization is intended topreserve relevant characteristics of the data while eliminatingunimportant characteristics. Prior to quantization, lossy compressionsystem often use a transform to provide energy compaction. JPEG is anexample of a lossy coding method for image data.

Recent developments in image signal processing continue to focusattention on a need for efficient and accurate forms of data compressioncoding. Various forms of transform or pyramidal signal processing havebeen proposed, including multi-resolution pyramidal processing andwavelet pyramidal processing. These forms are also referred to assubband processing and hierarchical processing. Wavelet pyramidalprocessing of image data is a specific type of multi-resolutionpyramidal processing that may use quadrature mirror filters (QMFs) toproduce subband decomposition of an original image. Note that othertypes of non-QMF wavelets exist. For more information on waveletprocessing, see Antonini, M., et al., “Image Coding Using WaveletTransform”, IEEE Transactions on Image Processing, Vol. 1, No. 2, April1992; Shapiro, J., “An Embedded Hierarchical Image Coder Using Zerotreesof Wavelet Coefficients”, Proc. IEEE Data Compression Conference, pgs.214–223, 1993. For information on reversible transforms, see Said, A.and Pearlman, W. “Reversible Image Compression via MultiresolutionRepresentation and Predictive Coding”, Dept. of Electrical, Computer andSystems Engineering, Renssealaer Polytechnic Institute, Troy, N.Y. 1993.

Compression is often very time consuming and memory intensive. It isdesirable to perform compression faster and/or with reduced memory whenpossible. Some applications have never used compression because eitherthe quality could not be assured, the compression rate was not highenough, or the data rate was not controllable. However, the use ofcompression is desirable to reduce the amount of information to betransferred and/or stored.

Digital copiers, printers, scanners and multifunction machines aregreatly enhanced with a frame store. A compressed frame store reducesmemory and thus the costs required for a frame store in these products.However, many frame stores are implemented with random access memories(RAMs). RAM is fast but generally expensive. Hard disks may also be usedas memories, and are generally considered inexpensive (or less expensivegenerally than RAM). Therefore, any system manufacturer would find anadvantage in producing a lesser expensive system using a hard disk, forpurposes such as a frame store, instead of RAM.

One problem with using hard disks for time sensitive applications isthat it is difficult to directly access information from a hard disk asfast as the same information could be accessed from a RAM. Also, manyhard disks utilize compression when storing information onto the disk toincrease the amount of information that may be stored onto the disk. Thetime necessary to perform the compression may also be a deterrent tousing hard disks in time sensitive applications. Both the slow speedinherent in the use of hard disks and the use of compression makeutilizing hard disks in time sensitive applications a difficultimplementation issue.

The present invention provides for fast lossy/lossless compression. Thepresent invention sets forth system implementations that permit usage ofinexpensive hard disk technology instead of expensive RAM. Furthermore,the present invention provides for rate matching to a hard disk and forusing compression to match the hard disk to bandwidths of other portionsof the system implementation, such as a print engine. The presentinvention also provides for using RAM where the time to compress anddecompress is not much slower than the RAM speed. In this way, thepresent invention performs rate matching to RAM.

SUMMARY OF THE INVENTION

A method and apparatus for performing compression and/or decompressionis described. In one embodiment, the present invention comprises asystem having a buffer, a wavelet transform unit, and a coder. Thewavelet transform unit has an input coupled to the buffer to perform awavelet transform on pixels stored therein and to generate coefficientsat an output. The coder is coupled to the wavelet transform unit to codethe transformed pixels received from the buffer.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention will be understood more fully from the detaileddescription given below and from the accompanying drawings of variousembodiments of the invention, which, however, should not be taken tolimit the invention to the specific embodiments, but are for explanationand understanding only.

FIG. 1A shows the context dependent relationships. Children areconditioned on their parents.

FIG. 2A illustrates an order that is similar to raster order.

FIG. 2B illustrates an alternative embodiment of an order, which isreferred to herein as the short seam order.

FIG. 2C shows an alternative short seam order.

FIGS. 3A through 3H illustrate the result of each application of theTS-transform filter for a four level transform on a wavelet tree of thepresent invention.

FIG. 4A is a block diagram of one embodiment of a forward/inverse filterunit for use in implementing the one dimensional filters.

FIG. 4B is a block diagram of one embodiment of a first level forwardtransform according to the present invention.

FIG. 5 is a block diagram of one embodiment of a complete forwardtransform according to the present invention.

FIG. 6 is a timing diagram of when coefficients are output.

FIGS. 7A through 7H show the results (outputs) of each one dimensionalfiltering operation for the TT-transform.

FIG. 8 is a block diagram of a 10 tap forward/inverse filter unit.

FIG. 9 is a block diagram of one embodiment of the overlap unit for theforward/inverse filter of FIG. 8.

FIG. 10 illustrates the ordering of the codestream and the orderingwithin a coding unit.

FIG. 11 illustrates the bit depths of the various coefficients in atwo-level TS-transform and TT-transform decomposition from an inputimage with b bits per pixel.

FIG. 12 is one embodiment of the multipliers for the frequency band usedfor coefficient alignment in the present invention.

FIG. 13A shows a coefficient divided into most important data and lessimportant data.

FIG. 13B shows the lossless case where no data is discarded.

FIG. 13C shows the case where one bitplane of data has been discarded(i.e., Q=2) because discarding a bitplane is equivalent to division by2.

FIG. 14 is a flow chart illustrating one embodiment of the operation ofthe compression/decompression system.

FIG. 15 shows one embodiment where 6 bits are used for each tree.

FIG. 16 is a flow chart for coding the most important chunk.

FIG. 17 is a block diagram of one embodiment of the formatting unit andcontext model used during the most important data coding pass.

FIG. 18 illustrates one embodiment of a first bitplane unit.

FIG. 19 is a flow chart illustrating one embodiment of the process ofcoding a LIC bitplane.

FIG. 20 is a block diagram of one embodiment of the look-ahead andcontext models for less important data.

FIG. 21 is a block diagram of one embodiment of the context model whichprovides the conditioning for head bits.

FIG. 22 illustrates the memory usage for one embodiment of the contextmodel with conditioning on all neighbors and parents.

FIG. 23 is a block diagram of one embodiment of the context model forsign bits.

FIG. 24 illustrates one embodiment of parallel coding for the LIC.

FIG. 25 is a block diagram of one embodiment of the front end of aprinter.

FIG. 26 is a block diagram of one embodiment of the back end of theprinter.

FIG. 27 is a block diagram of an alternate embodiment of the backend ofthe printer.

FIG. 28 is a block diagram of one embodiment of an integrated circuit(IC) chip containing the printer compression/decompression.

FIG. 29 illustrates the basic timing of the system during printing.

FIG. 30 illustrates one possible embodiment of how pixel data isorganized.

FIG. 31 illustrates a band buffer of a page.

FIG. 32 illustrates a timing diagram of decoding that illustratesconcurrent memory access requirements.

FIG. 33 shows how circular addressing can be used to handle writing datathat is larger than the data read.

FIG. 34 illustrates an encoder and decoder pair.

FIG. 35 shows illustrates one embodiment of a binary context model.

FIG. 36 illustrates an alternate embodiment of a binary context model.

FIG. 37 shows the neighborhood coefficients for every coefficient of acoding unit.

FIG. 38 illustrates pyramidal alignment based on MSE alignment.

FIG. 39 illustrates MSE alignment of wavelet coefficients.

DETAILED DESCRIPTION OF THE PRESENT INVENTION

A method and apparatus for compression and decompression are described.In the following description, numerous details are set forth, such astypes of delays, bit rates, types of filters, etc. It will be apparent,however, to one skilled in the art, that the present invention may bepracticed without these specific details. In other instances, well-knownstructures and devices are shown in block diagram form, rather than indetail, in order to avoid obscuring the present invention.

Some portions of the detailed descriptions which follow are presented interms of algorithms and symbolic representations of operations on databits within a computer memory. These algorithmic descriptions andrepresentations are the means used by those skilled in the dataprocessing arts to most effectively convey the substance of their workto others skilled in the art. An algorithm is here, and generally,conceived to be a self-consistent sequence of steps leading to a desiredresult. The steps are those requiring physical manipulations of physicalquantities. Usually, though not necessarily, these quantities take theform of electrical or magnetic signals capable of being stored,transferred, combined, compared, and otherwise manipulated. It hasproven convenient at times, principally for reasons of common usage, torefer to these signals as bits, values, elements, symbols, characters,terms, numbers, or the like.

It should be borne in mind, however, that all of these and similar termsare to be associated with the appropriate physical quantities and aremerely convenient labels applied to these quantities. Unlessspecifically stated otherwise as apparent from the followingdiscussions, it is appreciated that throughout the present invention,discussions utilizing terms such as “processing” or “computing” or“calculating” or “determining” or “displaying” or the like, refer to theaction and processes of a computer system, or similar electroniccomputing device, that manipulates and transforms data represented asphysical (electronic) quantities within the computer system's registersand memories into other data similarly represented as physicalquantities within the computer system memories or registers or othersuch information storage, transmission or display devices.

The present invention also relates to apparatus for performing theoperations herein. This apparatus may be specially constructed for therequired purposes, or it may comprise a general purpose computerselectively activated or reconfigured by a computer program stored inthe computer. Such a computer program may be stored in a computerreadable storage medium, such as, but is not limited to, any type ofdisk including floppy disks, optical disks, CD-ROMs, and magneto-opticaldisks, read-only memories (ROMs), random access memories (RAMs), EPROMs,EEPROMs, magnet or optical cards, or any type of media suitable forstoring electronic instructions, and each coupled to a computer systembus. The algorithms and displays presented herein are not inherentlyrelated to any particular computer or other apparatus. Various generalpurpose machines may be used with programs in accordance with theteachings herein, or it may prove convenient to construct morespecialized apparatus to perform the required method steps. The requiredstructure for a variety of these machines will appear from thedescription below. In addition, the present invention is not describedwith reference to any particular programming language. It will beappreciated that a variety of programming languages may be used toimplement the teachings of the invention as described herein.

The following terms are used in the description that follows. Adefinition has been included for these various terms. However, thedefinition provided should not be considered limiting to the extent thatthe terms are known in the art. These definitions are provided to helpin the understanding of the present invention.

ABS coding: A method of parallel entropy coding using simple codes(e.g., run codes) for bit generation and probability estimation based onthe codewords used (e.g., tabular probability estimation). In oneembodiment, ABS coding also includes a method for multiplexing anddemultiplexing streams from several coders. alignment: The degree ofshifting of the transform coefficients in a frequency band with respectto the other frequency bands. Arithmetic coding: Shannon/Elias Codingwith finite precision arithmetic, not necessarily a binary entropycoder. B-coding: A binary entropy coder that uses a finite state machinefor compression. Unlike Huffman coding, using the finite state machinedoes well with binary symbols, and is useful for a range of inputprobabilities. Binary entropy coder: A noiseless coder which acts onbinary (yes/no) decisions, often expressed as the most probable symbol(mps) and least probable symbol (lps). binary-style: Coding style withedge-fill Gray encoding of the pixels and a particular context model.binary-style context A context model for bi-level and limited-levelmodel: image data. bit-significance: A number representation, similar tosign magnitude, with head bits, followed by the sign bit, followed bytail bits, if any. The embedding encodes in bit-plane order with respectto this representation. child-based order: A scan order through a twodimensional image. It is similar to raster order except that the scanworks on two by two blocks. Consider scanning a “parent” frequency bandin raster order. Each coefficient will have four children. Thesechildren are ordered from top-left, top- right, bottom-left, andbottom-right followed by the next parent and the next set of fourchildren and so on until the end of the line. Then processing returns tothe next two lines and eventually ends in the lower right corner. Nolines are skipped. Child-based order is also referred to as 2x2 blockorder. coefficient: Components after the transform. components:Constituent parts of the image. The components make up the pixels. Forexample, the red, green, and blue bands are component bands. Eachindividual pixel is made up of a red, green, and blue component.Components and component bands can contain any type of information thathas a spatial mapping to the image. context model: Causally availableinformation relative to the current bit to be coded that giveshistorically- learned information about the current bit, enablingconditional probability estimation for entropy coding. In binary images,a possible context for a pixel is the previous two pixels in the samerow and three pixels from the previous row. decomposition level: Placein the wavelet decomposition pyramid. This is directly related toresolution. efficient transform: Transform that achieves the best energycompaction into the coefficients while using the minimum number of bitsto represent those coefficients. Embedded context model: A context modelwhich separates the context bins and results into levels of importancein such a way that effective lossy compression is obtained if the moreimportant values are retained. Embedded with ordering: A special case ofembedded context models where there is not an explicit labeling ofimportance, but rather the compressed data is ordered with the mostimportant data in the front. embedded quantization: Quantization that isimplied by the codestream. For example, if the importance levels areplaced in order, from the most important to the least, then quantizationis performed by simple truncation of the codestream. The samefunctionality is available with tags, markers, pointers, or othersignaling. Multiple quantizations can be performed on an image atdecode, but only one embedded quantization can be performed at encodetime. entropy coder: A device that encodes or decodes a current bitbased on a probability estimation. An entropy coder may also be referredto herein as a multi- context binary entropy coder. The context of thecurrent bit is some chosen configuration of “nearby” bits and allowsprobability estimation for the best representation of the current bit(or multiple bits). In one embodiment, an entropy coder may include abinary coder, a parallel run-length coder or a Huffman coder. entrypoint: A point in the coded data that starts with a known coding state.The decoder can start decoding at this point without decoding theprevious data. In most cases, this requires that the context and thebinary entropy coder be reset into an initial state. The coded data foreach coding unit begins at an entry point. fixed-length: A system thatconverts a specific block of data to a specific block of compresseddata, e.g., BTC (block truncation coding) and some forms of VQ (vectorquantization). Fixed-length codes serve fixed-rate and fixed-sizeapplications, but the rate-distortion performance is often poor comparedwith variable-rate systems. fixed-rate: An application or system thatmaintains a certain pixel rate and has a limited bandwidth channel. Inone embodiment, to attain this goal, local average compression isachieved rather than a global average compression. For example, MPEGrequires a fixed-rate. fixed-size: An application or system that has alimited size buffer. In one embodiment, to attain this goal, a globalaverage compression is achieved, e.g., a print buffer. (An applicationcan be fixed-rate, fixed-size, or both.) frequency band: Each frequencyband describes a group of coefficients resulting from the same sequenceof filtering operations. head bits: In bit-significance representation,the head bits are the magnitude bits from the most significant up to andincluding the first non- zero bit. Huffman Coder: Generally, a fixedlength code which produces an integral number of bits for each symbol.importance levels: The unit of coded data which corresponds, beforecompression, to an entire bit-plane of the embedded data. The importancelevel includes all appropriate bit-planes from the different coefficientfrequency bands. LPS (Least Probable Symbol): The outcome in a binarydecision with less than 50% probability. When the two outcomes areequally probable, it is unimportant which is designated mps or lps aslong as both the encoder and decoder make the same designation.Lossless/Noiseless/Reversible coding: Compressing data in a manner whichallows perfect reconstruction of the original data. Lossy Coding: Codingof data which does not guarantee perfect reconstruction of the originaldata. The changes to the original data may be performed in such a way asto not be visually objectionable or detectable. Often fixed rate ispossible. MPS (Most Probable Symbol): The outcome of a binary decisionwith more than 50% probability. overlapped transform: A transform wherea single source sample point contributes to multiple coefficients of thesame frequency. Examples include many wavelets and the Lapped OrthogonalTransform. parent coefficient: The coefficient or pixel in the nexthigher pyramidal level that covers the same image space as the currentcoefficient or pixel. For example, the parent of the 1SD coefficients isthe 2SD coefficients which is the parent of the 3SD coefficients inFigure 1A. Probability Estimation Machine/Module: Part of a codingsystem which tracks the probability within a context. progressive pixeldepth: A codestream that is ordered with deepening bit-planes of data atfull image resolution. progressive pyramidal: Succession of resolutionswhere each lower resolution is a linear factor of two in each dimension(a factor of four in area). Q-Coder A binary arithmetic coder whereadditions have been substituted for multiplications and probabilitieslimited to discrete values and probability estimates are updated whenbits are output. raster order: A scan order through a two dimensionalimage. It starts in the upper left corner, moves left to right, thenreturns to the left side of the next line, finally ending in the lowerright corner. No lines are skipped. reversible transform: In oneembodiment, a reversible transform is an efficient transform implementedwith integer arithmetic whose compressed results can be reconstructedinto the original. tail-bits (or tail): In bit-significancerepresentation, the tail bits are the magnitude bits with lesssignificance than the most significant non-zero bit. tile data segment:Portion of the codestream fully describing one coding unit.TS-transform: Two-Six transform, a specific reversible wavelet filterpair with a 2-tap low pass analysis and a 6-tap high pass analysisfilter. The synthesis filters are quadrature mirror of the analysisfilters. TT-transform: Two-Ten transform, a specific reversible waveletfilter pair with a 2-tap low pass analysis and a 10-tap high passanalysis filter. The synthesis filters are quadrature mirror of theanalysis filters. unified lossless/lossy: The same compression systemprovides a codestream capable of lossless or lossy reconstruction. Inone embodiment of the present invention, this codestream is capable ofboth without settings or instructions to the encoder. wavelet filters:The high and low pass synthesis and analysis filters used in wavelettransform. wavelet transform: A transformation with both “frequency” and“time (or space)” domain constraints. In one embodiment, it is atransform comprising a high pass filter and a low pass filter. Theresulting coefficients are decimated by two (critically filtered) andthe filters are applied to the low pass coefficients. wavelet trees: Thecoefficients, and the pixels, that are related to a single coefficientin the SS section of the highest level wavelet decomposition. The numberof coefficients is a function of the number of levels. FIGURE 1Aillustrates the coefficients included in a wavelet tree. The span of awavelet tree is dependent on the number of decomposition levels. Forexample, with one level of decomposition, a wavelet tree spans fourpixels, with two levels it spans 16, etc. Table 1 below illustrates thenumber of pixels affected by a wavelet tree for different levels. In twodimensions, each wavelet tree comprises three subtrees called SD, DD andDS.

TABLE 1 Span of a Wavelet Tree for Different Levels of DecompressionWidth Height Total 1 level  2 2 4 2 levels 4 4 16 3 levels 8 8 64 4levels 16 16 256 5 levels 32 32 1024 6 levels 64 64 4096Overview of the Present Invention

The present invention provides a compression/decompression system havingan encoding portion and a decoding portion. The encoding portion isresponsible for encoding input data to create compressed data, while thedecoding portion is responsible for decoding previously encoded data toproduce a reconstructed version of the original input data. The inputdata may comprise a variety of data types, such as image (still orvideo), audio, etc. In one embodiment, the data is digital signal data;however, analog data digitized, text data formats, and other formats arepossible. The source of the data may be a memory or channel for theencoding portion and/or the decoding portion.

In the present invention, elements of the encoding portion and/or thedecoding portion may be implemented in hardware or software, such asthat used on a computer system. The present invention provides alossless compression/decompression system. The present invention mayalso be configured to perform lossy compression/decompression.

The system of the present invention employs fast lossy/losslesscompression by reversible wavelets, which is described in greater detailbelow. The system may include a printer, such as, for example, a laserprinter. In one embodiment, the printer uses an inexpensive hard disk tostore a rendered page, greatly reducing the amount of expensive randomaccess memory (RAM) required. Compression is used to match the limitedbandwidth of the hard disk or other storage device to the greaterbandwidth required by the print engine. The coding technology of thepresent invention meets the high speed, real-time requirements of theprint engine, while the present invention provides either excellentlossless or lossy compression as required by image characteristics andthe bursty nature of the hard disk.

The following detailed description sets forth a general overview ofcompression by reversible wavelets, a compressed frame storeapplication, a color laser printer, and embodiments of a printer chip.The printer's rendering engine uses a hard disk for storage. Because thehard disk is slower than the print engine, compression is used toprovide rate matching. Display list technology may also be used todecrease the memory required while rendering. A display-list basedrendering engine allows the compression system to handle bands of theimage independently. Note that although the present invention isdescribed in terms of a printer system, the present invention isapplicable to other systems that include compression and/ordecompression subsystems as portions thereof.

Also discussed herein is an embedded unified lossless/lossy compressionsystem. The embedded characteristic of the system allows quality to bedetermined by the transfer rate of the disk. For easily compressedimages (e.g., most documents with text and/or line art), losslesscompression is achieved. For difficult to compress images (e.g.,documents with noisy natural images and/or halftones), high qualitylossy compression is achieved.

For a description of a system(s) that supports both lossless-compressionand high quality lossy compression of color images, see U.S. patentapplication Ser. No. 08/642,518, filed May 3, 1996 and entitled“Compression and Decompression with Wavelet Style and Binary StyleIncluding Quantization by Device-Dependent Parser” and U.S. patentapplication Ser. No. 08/436,662, filed May 8, 1995 and entitled “Methodand Apparatus for Reversible Color Conversion”.

Reversible Wavelets

The present invention employs compression by reversible wavelets.

Wavelet Decomposition

The present invention initially performs decomposition of an image (inthe form of image data) or another data signal using reversiblewavelets. In the present invention, a reversible wavelet transformcomprises an implementation of an exact-reconstruction system in integerarithmetic, such that a signal with integer coefficients can belosslessly recovered. An efficient reversible transform is one withtransform matrix of determinant equals 1 (or almost 1).

By using reversible wavelets, the present invention is able to providelossless compression with finite precision arithmetic. The resultsgenerated by applying the reversible wavelet transform to the image dataare a series of coefficients.

The reversible wavelet transform of the present invention may beimplemented using a set of filters. In one embodiment, the filters are aTwo-tap low-pass filter and a Six-tap high-pass filter to implement atransform referred to herein as the TS transform, or 2,6 transform. Inanother embodiment, the filters are a Two-tap low-pass filter and aTen-tap high-pass filter to implement a transform referred to herein asthe TT transform, or 2,10 transform. These filters may be implementedusing only addition and subtraction operations (plus hardwired bitshifting).

The TT-transform has at least one advantage and at least onedisadvantage with respect to the TS-transform. One advantage is that itprovides better compression that the TS-transform. The disadvantage ofthe TT-transform is that the longer 10-tap filter requires a higherhardware cost.

Two-Dimensional Wavelet Decomposition

Using the low-pass and high-pass filters of the present invention, amulti-resolution decomposition is performed. The number of levels ofcomposition is variable and may be any number; however, currently thenumber of decomposition levels equals from two to eight levels. Themaximum number of levels is the log₂ of the maximum of the length orwidth of the input.

The most common way to perform the transform on two-dimensional data,such as an image, is to apply the one-dimensional filters separately,i.e., along the rows and then along the columns. The first level ofdecomposition leads to four different bands of coefficients, referred toherein as SS, DS, SD, and DD. The letters refer to the smooth (S) anddetail (D) filters defined above, which correspond to low (L) and high(H) pass filters respectively. Hence, the SS band consist ofcoefficients from the smooth filter in both row and column directions.

Each frequency subband in a wavelet decomposition can be furtherdecomposed. The most common practice is to only decompose the SSfrequency subband further, and may include further decomposing of the SSfrequency subband in each decomposition level as each is generated. Sucha multiple decomposition is referred to as a pyramidal decomposition.The designations SS, SD, DS, DD and the decomposition level numberdenote each decomposition.

Note that with either the TS or TT transforms of the present invention,the pyramidal decomposition does not increase the coefficient size.

If the reversible wavelet transform is recursively applied to an image,the first level of decomposition operates on the finest detail, orresolution. At a first decomposition level, the image is decomposed intofour sub-images (e.g., subbands). Each subband represents a band ofspatial frequencies. The first level subbands are designated 1SS, 1SD,1DS, and 1DD. The process of decomposing the original image involvessubsampling by two in both horizontal and vertical dimensions; such thatthe first level subbands 1SS, 1SD, 1DS and 1DD each have one-fourth asmany coefficients as the input has pixels (or coefficients) of theimage.

Subband 1SS contains simultaneously low frequency horizontal and lowfrequency vertical information. Typically a large portion of the imageenergy is concentrated in this subband. Subband 1SD contains lowfrequency horizontal and high frequency vertical information (e.g.,horizontal edge information). Subband 1DS contains high frequencyhorizontal information and low frequency vertical information (e.g.,vertical edge information). Subband 1DD contains high frequencyhorizontal information and high frequency vertical information (e.g.,texture or diagonal edge information).

Each of the succeeding second, third and fourth lower decompositionlevels is produced by decomposing the low frequency SS subband of thepreceding level. This subband 1SS of the first level is decomposed toproduce subbands 2SS, 2SD, 2DS and 2DD of the moderate detail secondlevel. Similarly, subband 2SS is decomposed to produce coarse detailsubbands 3SS, 3SD, 3DS and 3DD of the third level. Also, subband SS₂ isdecomposed to produce coarser detail subbands 4SS, 4SD, 4DS and 4DD ofthe third level. Due to subsampling by two, each second level subband isone-sixteenth the size of the original image. Each sample (e.g., pixel)at this level represents moderate detail in the original image at thesame location. Similarly, each third level subband is 1/64 the size ofthe original image. Each pixel at this level corresponds to relativelycoarse detail in the original image at the same location. Also, eachfourth level subband is 1/256 the size of the original image.

Since the decomposed images are physically smaller than the originalimage due to subsampling, the same memory used to store the originalimage can be used to store all of the decomposed subbands. In otherwords, the original image and decomposed subbands 1SS and 2SS arediscarded and are not stored in a three level decomposition.

Although only four subband decomposition levels are described,additional levels could be developed in accordance with the requirementsof a particular system. Also, with other transformations such as DCT orlinearly spaced subbands, different parent-child relationships may bedefined.

Note that pyramidal decomposition does not increase the coefficient sizewith the wavelet filters of the present invention.

In other embodiments, other subbands in addition to the SS may bedecomposed also.

Tree Structure of Wavelets

There is a natural and useful tree structure to wavelet coefficients ina pyramidal decomposition. A result of the subband decomposition is asingle SS frequency subband corresponding to the last level ofdecomposition. On the other hand, there are as many SD, DS, and DD bandsas the number of levels. The tree structure defines the parent of acoefficient in a frequency band to be a coefficient in a same frequencyband at a lower resolution and related to the same spatial locality.

In the present invention, each tree comprises the SS coefficients andthree subtrees, namely the DS, SD and DD subtrees. The processing of thepresent invention is typically performed on the three subtrees. The rootof each tree is a purely smooth coefficient. For a two-dimensionalsignal such as an image, there are three subtrees, each with fourchildren. The tree hierarchically is not limited to two dimensionalsignals. For example, for a one dimensional signal, each subtree has onechild. Higher dimensions follow from the one-dimensional andtwo-dimensional cases.

The process of multi-resolution decomposition may be performed using afiltering system. For examples of a two-dimensional, two-leveltransform, a two-dimensional, two-level transform implemented usingone-dimensional exemplary filters, see U.S. patent application Ser. No.08/498,695, filed Jun. 30, 1995 and entitled “Method and Apparatus ForCompression Using Reversible Wavelet Transforms and an EmbeddedCodestream” and U.S. patent application Ser. No. 08/498,036, filed Jun.30, 1995, entitled “Reversible Wavelet Transform and Embedded CodestreamManipulation”.

Performing the Forward Wavelet Transform

In the present invention, the wavelet transform is performed with two1-D operations, horizontal then vertical. In one embodiment, one pieceof hardware performs the horizontal operation while another performs thevertical operations.

The number of levels determine the number of iterations. In oneembodiment, a four level decomposition is performed using the TTtransform in both the horizontal and vertical directions. In anotherembodiment, a four level decomposition is performed using fourTS-transforms instead.

The transform of the present invention is extremely computationallyefficient. In one embodiment, the present invention orders thecomputations performed by the transform to reduce the amount of bothon-chip and off-chip memory and bandwidth required.

Computation Orders and Data Flow for the Transform

As discussed above in the present invention, the basic unit forcomputing the transform is the wavelet tree. Assuming a four leveltransform, each wavelet tree is a 16×16 block of pixels. A 16×16 blockof pixels (all four components for CMYK images) are input to thetransform of the present invention, and all of the possible calculationsto generate coefficients are performed. (The inverse is similar, a 16×16block of coefficients for each component is input and all possiblecalculations are performed). Since the present invention employs anoverlapped transform, information from previous, neighboring trees isstored and used in calculations. The boundary between the currentwavelet tree and the previous, neighboring information is referred toherein as a seam. The information that is preserved across a seam toperform the transform of the present invention is described in detailbelow.

Ordering of Wavelet Trees

The ordering of wavelet trees for computing the transform is importantbecause, in certain applications (e.g., printing), coding units of thepresent invention have a large width and a small height. In oneembodiment, each coding unit contains 4096×256 pixels.

In the following discussion, each of the coding units contains 4096×256pixels. However, it should be noted that the ordering described below isapplicable to coding units of other sizes. FIG. 2A illustrates an orderthat is similar to raster order. This order is referred to herein as thelong seam transform order. Referring to FIG. 2A, the thick linesindicate the amount of data that is preserved across seams, and isindicative of how much storage is required to compute the transform.This data is proportional to one wavelet tree for the horizontaltransform, but to the width of the image (4096 in this example) for thevertical transform. The amount of storage for this data may require theuse of external memory. However, because of the closeness to rasterorder, during the inverse transform, data can be output from thetransform (to, for instance, a printer in a printer application) as soonas a horizontal row of wavelet trees has to be converted to pixels.

FIG. 2B illustrates an alternative embodiment of an order, which isreferred to herein as the short seam order. The storage for seams isproportional to the height of the coding unit (256 in this example) forthe horizontal transform and one wavelet tree for the verticaltransform. This greatly reduces the amount of memory required, makingon-chip storage practical.

FIG. 2C shows an alternative short seam order. At the cost of storageproportional to one more wavelet tree, the number of consecutive pixelsprocessed in raster order is increased. This alternative or similaralternatives may allow for more efficient use of fast page mode orextended data out (EDO) RAM in the band buffer with little extra cost inseam memory. The efficient is gained by the fact that most memories aredesired or optimized for accesses to adjacent memory locations.Therefore, any increase in the use of adjacent memory accesses due tothe seam order results in more efficient memory usage.

Computation for One Wavelet Tree

The following equations define both the TS-transform and theTT-transform. For an input x(n), the output of the low pass filter, thesmooth signal s(n), and the high pass filter, the detail signal d(n) arecomputed as shown in the equation below.

$\quad\left( \begin{matrix}{{s(n)} = \left\lfloor \frac{{x\left( {2n} \right)} + {x\left( {{2n} + 1} \right)}}{2} \right\rfloor} \\{{d(n)} = {{x\left( {2n} \right)} - {x\left( {{2n} + 1} \right)} + {t(n)}}}\end{matrix} \right.$The inverse transform is shown in the equation below.

$\quad\left( \begin{matrix}{{x\left( {2n} \right)} = {{s(n)} + \left\lfloor \frac{{p(n)} + 1}{2} \right\rfloor}} \\{{x\left( {{2n} + 1} \right)} = {{s(n)} - \left\lfloor \frac{p(n)}{2} \right\rfloor}}\end{matrix} \right.$where p(n) is computed by:p(n)=d(n)−t(n).The TS-transform and the TT-transform differ in the definition of t(n).For the TS-transform.

${t(n)} = {\left\lfloor \frac{{- {s\left( {n - 1} \right)}} + {s\left( {n + 1} \right)} + 2}{4} \right\rfloor.}$For the TT-transform,

${t(n)} = \left\lfloor \frac{{3{s\left( {n - 2} \right)}} - {22{s\left( {n - 1} \right)}} + {22{s\left( {n + 1} \right)}} - {3{s\left( {n + 2} \right)}} + 32}{64} \right\rfloor$

Note that in the following discussion the notation └.┘ means to rounddown or truncate and is sometimes referred to as the floor function.

The TS-Transform

The effect of using the six tap filter and a two tap filter at evenlocations is that three pieces of information must be stored. The sixtap filter requires two delays. The two tap filter requires one delay soits result can be centered with respected to the six tap filter'sresult. Specifically, two s(●) values and one d(●) value or a partialresult from the d(●) calculation must be stored. Storage of these valuesis identical regardless of whether or not a particular filteringoperation crosses a seam or not.

FIGS. 3A through 3H illustrate the result of each application of theTS-transform filter for a four level transform on a wavelet tree of thepresent invention. In these figures, the output of the low pass filteris denoted as “s” for smooth. The output of the high pass filter isdenoted “d” for detail. The “B” denotes an intermediate value used tocompute a “d”; it is a x(2n)−x(2n+1) value. The “B” values are usedduring the forward transform; for the inverse transform, a “d” valuethat is not used in any computations is stored in its place. Thenotation “sd” indicates that a coefficient is the result of first ahorizontal low pass filter and then a vertical high pass filter. Themeanings of “ds”, “dd”, “ss”, “dB” and “sB” are similar. The bold squarecorresponds to the 256 input pixels. The shaded “s”, “ds” and “ss”values are computed with a previous wavelet tree and stored for use inthe current wavelet tree.

For the forward transform, the inputs to levels 2, 3 and 4 of thetransform are the “ss” coefficients from the previous level. The “sd”,“ds” and “dd” coefficients are finished, so they can be output whencomputed. The inverse transform does all the computations in reverseorder with respect to level (the 4th level first, then, 3, 2, andfinally 1), and vertical (first) and horizontal (second). Within a passof the transform, the data flow of the forward and inverse areidentical, just the computation is different.

TS-Transform Hardware

FIG. 4A is a block diagram of one embodiment of a forward/inverse filterunit for use in implementing the one dimensional filters. Only memoryand computational units are shown, hardwired shifts are not shown.Referring to FIG. 4A, filter unit 4000 handles both the forward andinverse transform. Alternate embodiments may use separate units for theforward and inverse transforms. For the forward transform, the size “n”inputs are used, and the “s” and “d” outputs are generated. For theinverse transform, the “s” and “d” inputs are used and the other outputsare generated.

Adder 4001 is coupled to receive the n bit inputs and add them togetherto produce an output of x(2n+2)+x(2n+3). Adder 4002 subtracts one n bitinput from the other and outputs a quantity of x(2n+2)−x(2n+3). Theoutputs of adders 4001 and 4002 are coupled to one input of muxes 4003and 4004 respectively. The other input of to muxes 4003 and 4004 arecoupled to receive the s and d inputs respectively. In one embodiment,the s input is n bits, while the d input is greater than n bits.

The output of muxes 4003 and 4004 is controlled by a forward/inversecontrol signal indicative of whether the filter is in the forward orinverse mode. In either the forward or inverse mode, the output of mux4003 is equal to s(n+1). On the other hand, the output of mux 4004 isequal to p(n+1) in the forward mode and d(n+1) in the inverse mode. Theoutputs of mux 4003 and 4004 along with a feedback of s(n) output frommux 4006 are coupled to the inputs of register file 4005. Register file4005 contains the entries for each component for the length of onewavelet tree. The data typically passes through register file 4005.Based on the spatial location, the inputs to register 4005 are delayedto the output. An address input controls the outputs of register file4005. In one embodiment, register file 4005 comprises two banks ofmemory with one port per bank and is used in a ping-pong style accessesback and forth between the two banks of memory.

The output of mux 4003 is also the s output of the filter unit.

The outputs of register file 4005 are coupled to inputs of mux 4006along with externally buffered data at seam buffer in 4020. The output4006A comprises the s(n−1) which is a twice delayed version of theoutput of mux 4003. The output 4006B comprises s(n) which is a delayedversion of s(n+1). The output 4006C comprises p(n) for the forward modeand d(n) for the inverse mode. Mux 4006 is also controlled to provideseam data to be externally buffered at seam buffer out 4021.

The output of 4006C is coupled to one input of adders 4008 and 4009. Theother input of adders 4008 and 4009 is the output of mux 4015. Mux 4015handles boundary conditions. On a boundary, mux 4015 outputs as zerothat is hardwired to one of its inputs. The hardwired zero may bechanged to use other values in some embodiments. In a non-boundarycondition, mux 4015 outputs t(n) which is output from adder 4007 whichis coupled to add s(n+1) on one input to s(n−1) on another input bysubtracting s(n−1) from s(n+1).

Adder 4008 adds the output 4006C of mux 4006 to the output of mux 4015to generate the d output of the filter unit.

Adder 4009 subtracts the output of 4006C of mux 4006 from the output ofmux 4015. The output of adder 4009 is added to s(n) on output 4006B ofmux 4006 by adder 4010 to generate an n bit output of the filter unit.The output of 4009 is also subtracted from s(n) of output 4006B of mux4006 by adder 4011, which outputs the other n bit output of the filterunit in the inverse direction.

For seams longer than one wavelet tree, seam data may be stored inon-chip static RAM (SRAM) or external memory instead of in register file4005. Mux 4006 provides access to and from this additional seam memory.

Most of the hardware cost of filter unit 4000 is due to register file4005. The total amount of memory required is dependent of the number offilter units. In one embodiment, a total of 60 locations for storingthree values (s, s, d or ss, ss, sd) is required. When more filter unitsare used, the memory required for each is less. Therefore, the hardwarecost of using multiple filter units is low.

A fast inverse transform allows less latency between the end of decodingand the start of the data output operation, such as printing. Thisreduces the workspace memory required for decompression and allowslarger coding units. A fast forward transform allows the filter tohandle bursts of data when more bandwidth is available, which, in turn,allows the transform to supply more data to the context model when alook-ahead allows the context model to processes data quickly. If theforward transform cannot keep up with context model during encoding,disk bandwidth during encoding is wasted, delaying the time to startprinting. Also, the control and dataflow may be simplified by havingmultiple filters.

FIG. 4B is a block diagram of one embodiment of a first level forwardtransform according to the present invention. Referring to FIG. 4B, twofilter units 401 and 402, such as those described in FIG. 4A, performthe first level of the transform. Filter unit 401 performs a level 1horizontal transform, while filter unit 402 performs a level 1 verticaltransform. In one embodiment, the first level of the transform operateson 2×2 blocks of input. Four registers 403–406 operate as delay units todelay outputs of filter unit 401. This is referred to as child-basedorder. Register 403 receives the S output of filter unit 401, whileregisters 404 and 405 receive the d output. The output of register 404is coupled to the input of register 406. The outputs of registers 403and 406 are coupled to inputs of mux 407, while the s output of thefilter unit 401 and the output of register 405 are coupled to the inputsof mux 408. Two muxes 407 and 408 select inputs for filter unit 402 fromthose of the delayed coefficients output from filter unit 401.

Filter unit 401 operates consecutively on two vertically adjacent pairsof inputs. This creates four coefficients that can, with the properdelay provided by registers 403–406 for each component, be input tofilter unit 402. Three of the four results can be output immediately,the “ss” output is processed further.

The first level forward transfer operates on groups of four pixels whichare in 2×2 groupings. For the purposes of discussion, the first rowshould contain pixels a and b while the second row contains pixels c andd. The operation of the first level 4 transform in FIG. 4B is asfollows. During the first cycle, the horizontal transform is applied toa and b pixels which are processed by filter unit 401. Filter unit 401generates the S_(ab) which is stored in register 403 and D_(ab) which isstored in registers 404 and 405. In the next cycle, pixels c and d areprocessed by filter unit 401 to perform the horizontal transform. Theresults of applying filter unit 4001 is to generate S_(cd) which isstored in register 403 and D_(cd) which is stored in registers 404 and405. At this cycle, the S_(ab) from register 403 and the S_(cd) fromregister 405 are processed by filter unit 402 which performs a verticalpass of the transform and generates SS and SD. Also, during the secondcycle, the value D_(ab) moves from register 404 to register 406. In thenext cycle, the value D_(ab) from register 406 and D_(cd) from 405 areprocessed by filter unit 402, which generates the outputs of DS and DD.In the same cycle, filter unit 401 process the a and b pixels from thenext 2×2 block.

FIG. 5 is a block diagram of one embodiment of a forward transformaccording to the present invention. Referring to FIG. 5, level 1transform 502 performs the level 1 transform. In one embodiment, level 1transform comprises the level 1 transform of FIG. 4B. Filter unit 505handles levels 2, 3 and 4 of the transform. A memory 503 stores “ss”coefficients until sufficient coefficients are available to perform thetransform. The number of coefficients which need to be stored is shownin Table 2 below. (Each location stores a coefficient for eachcomponent).

TABLE 2 “ss” delay memory between levels memory needed 1 and 2 9locations 2 and 3 8 locations 3 and 4 4 locations

Order unit 504 multiplexes the proper inputs into filter unit 505. Inputbuffer 501 and output buffer 506 may be required to match between thetransfer order required by the transform and the order required by theband buffer or context model.

For the inverse transform, the dataflow is reversed with the level 4inverse transform being performed followed by the level 3, level 2 andlevel 1 transforms in order. The output of the level 2 transform is fedinto the first level transform hardware of level 1 transform 502. Also,vertical filtering is performed before horizontal filtering. Because ofthe horizontal and vertical filtering is identical except that onedirection requires access to additional memory for seams, reversing thedataflow can be performed with a small amount of multiplexing. Beforethe inverse transform, the two byte coefficients need to be convertedfrom the embedded form with two signaling bits into normal two'scomplement numbers.

The elements described in FIGS. 4B and 5 may also be used for theTT-Transforms as well.

Transform Timing

The transform timing of the forward transform of FIG. 5 is based on thetiming of the individual filter units. The first filter unit, filterunit 401, computes horizontal level 1 transforms, while the secondfilter unit, filter unit 402, computes vertical level 1 transforms. Thethird filter unit, filter unit 505, computes transforms for levels 2through 4 or is idle.

In one embodiment, the third filter unit (505), when not idle, computeshorizontal transforms during even clock cycles and vertical transformsduring odd clock cycles. The timing for the inverse transform is similar(but reversed).

In the following example, 2×2 blocks within a wavelet tree are processedin the transpose of raster order. Note that less input/output (I/O)buffering might be required to support fast page mode/extended data out(EDO) DRAM if 2×2 blocks within a wavelet tree are processed in rasterorder instead.

FIG. 6 is a timing diagram of when coefficients are output. Thefollowing timing is for each pixel. There are four components per pixel.

starting at time 0 do: for (x+0;x<16/2;x++) for (y=0;y<16;y++) applylevel 1 horizontal filter at x,y starting at time 1 do: for(x=0;x<16/2;x++)\ for (y=0;y<16/2;y++) for (xx=−1;xx<1;xx++) /*0=smooth, −1=previous detail */ apply level 1 vertical filter at2*x+xx,y for (x=0;x<8/2;x++) starting at time 18+x*32, at even times do:for (y=0;y<8;y++) apply level 2 horizontal filter at x,y for(x=0;x<8/2;x++) starting at time 21+x*32, at odd times do: for(y=0;y<8/2;y++) for (xx=−1;xx<1;xx++) /* 0=smooth, −1=previous detail */apply level 2 vertical filter at 2*x+xx,y for (x=0;x<4/2;x++) startingat time 66+x*64 at even times do: for (y=0;y<4;y++) apply level 3horizontal filter at x,y for (x=0;x<4/2;x++) starting at time 69+x*64,at odd times do: for (y=0;y<4/2;y++) for (xx=−1;xx<1;xx++) /* 0=smooth,−1=previous detail */ apply level 3 vertical filter at 2*x+xx,y at time138 apply level 4 horizontal filter at 0,0 at time 140 apply level 4horizontal filter at 0,1 at time 141 apply level 4 vertical filter at0,0 /* smooth */ at time 143 apply level 4 vertical filter at −1,0 /*previous detail */TT-Transform

FIGS. 7A–7H show the results (outputs) of each one dimensional filteringoperation of the IT transform. A rectangle indicates coefficients in asingle wavelet tree that corresponds to the input pixels currently beingprocessed, shading indicates coefficients that are stored from theprevious tree. Values labeled “B” are intermediate results that arestored (and are the different between adjacent samples). TheTT-transform is similar to the TS-transform, but requires more storage.

FIG. 8 is a block diagram of a 10 tap forward/inverse filter unit. Notethat hardwired shifts and rounding offsets are not shown to avoidobscuring the present invention. Note that mux 806 in FIG. 8 can also beused for mirroring at transform boundaries. For one implementation ofmirroring, zeroing the “d” input and multiplexing the s(n+2) input ofthe overlap unit is also required.

Referring to FIG. 8, adders 801 and 802 are coupled to receive the 2 nbit inputs during the forward pass of the filter unit. Adder 801 addsthe 2 n bit inputs and outputs a value coupled to one input of mux 803.Adder 802 subtracts one input from the other, generating its output toone input of mux 804. Muxes 803 and 804 are also coupled to receive thes and d inputs respectively for the inverse mode operation of the filterunit. The outputs of mux 803 is an n bit input equal to s(n+2), whilethe output of mux 804 is an n+1 bit input that is p(n+2) for the forwardpass and d(n+2) for the inverse pass.

Both outputs of muxes 803 and 804 are coupled to inputs of memory 805.Also coupled to inputs of memory 805 are the outputs 806A and 806D-Foutput from mux 806. Memory 805 delays the inputs to its outputs basedon spatial location. In one embodiment, memory 805 comprises a registerfile or an SRAM which is operated in a ping pong fashion with two banksand one port per bank. An address is coupled to an input of memory tocontrol the outputs which are generated to mux 806. In one embodiment,the address stores 16 or 28 locations per component.

The outputs of memory 805 are coupled to inputs of mux 806 along withexternal buffer data received from the seam buffer in 820. The output806A of mux 806 comprises s(n+1), which is a once delayed version ofs(n+2) at the output from mux 803. The output 806B of mux 806 comprisess(n), which is a twice delayed version of the output of mux 803. Theoutput 806C of mux 806 comprises p(n) for the forward pass, which is atwice delayed version of the output of mux 806 and d(n) in the inversepass, which is a twice delayed version of the output of mux 804. Theoutput 806D comprises s(n−2), which is a four times delayed version ofthe output of mux 803. The output 806E of mux 806 comprises s(n−1),which is three times delayed of output of mux 803. Lastly, the output806F comprises p(n+1) in the forward pass, which is a once delayedversion of the output of mux 804, and d(n+1) for the inverse pass, whichis a once delayed version of the output of mux 804.

Overlap unit 807 is coupled to receive the output of mux 803 along withthe outputs 806A, D and E from mux 806. In response to these inputs,overlap unit 807 generates t(n). One embodiment of the overlap unit isdescribed in FIG. 9.

The output of overlap unit 807, t(n), is coupled to one input of adders808 and 809. Adder 808 adds t(n) to the output 806C of mux 806 togenerate the D output of the filter unit. Adder 809 subtracts the output806C of mux 806 from t(n). The output of adder 809 is coupled to aninput of each of adders 810 and 811. Adder 810 adds the output of adder809 to the output 806B of mux 806 to produce one of the n bit outputs ofthe filter when operating as an inverse filter unit. Adder 811 subtractsthe output of adder 809 from the output 806B of mux 806 to generate theother output of the filter unit when operating as an inverse filter.

FIG. 9 is a block diagram of one embodiment of the overlap unit for theforward/inverse filter of FIG. 8. Referring to FIG. 9, the overlap unitcomprises adders 901–906, multipliers 907–909 and divider 910.Multipliers and dividers may be hardwired shifts.

The overlap unit of FIG. 9 computes t(n) for the TT transform describedabove. Referring to FIG. 9, adder 901 is coupled to receive the s(n+2)input and subtract it from the s(n−2) input and generates an outputwhich is coupled to one input of adder 903. Adder 902 is coupled toreceive the s(n−1) input and subtract from it the s(n+1) input. Theoutput of adder 902 is coupled to the input of multiplier 907 andmultiplier 908. Multiplier 907 multiplies its input by two. In oneembodiment the multiplication is performed by shifting the bits of theinput to the left one position. The output of multiplier 907 is coupledto the other input of adder 903.

Multiplier 908 multiplies the output of adder 902 by sixteen. In oneembodiment, the multiplication is performed by shifting the bits thatare output from adder 902 to the left four bit positions. The output ofmultiplexer 908 is coupled to one input of adder 905. The output ofadder 903 is coupled to one input of adder 904 and also to the input ofmultiplexer 909.

Multiplier 909 multiplies the output of adder 903 by two. In oneembodiment, this multiplication is performed by shifting the bits thatare output from adder 903 to the left one bit position. The output ofmultiplier 909 is coupled to the other input of adder 904. The output ofadder 904 is coupled to the other input of adder 905. The output ofadder 905 is coupled to an input of adder 906 which adds it to 32, whichis a hardwired input. The output of adder 906 is coupled to the input ofthe divider 910. The divider 910 divides the input by 64. In oneembodiment, this division is accomplished by shifting the bits of theinput to the right six bit positions. The output of divider 910comprises the t(n) output. Note also that FIG. 9 shows each of theoutputs with the current value on the lines.

Note that in both the reversible TS-transform and TT transform, like theS-transform, the low-pass filter is implemented so that the range of theinput signal x(n) is the same as the output signal s(n). That is, thereis no growth in the smooth output. If the input signal is b bits deep,then the smooth output is also b bits. For example, if the signal is an8-bit image, the output of the low-pass filter is also 8 bits. This isan important property for a pyramidal system where the smooth output isdecompressed further by, for example, successively applying the low-passfilter. In prior art systems, the range of the output signal is greaterthan that of the input signal, thereby making successive applications ofthe filter difficult. Also, there is no systemic error due to roundingin the integer implementation of the transform, so all error in a lossysystem can be controlled by quantization. In addition, the low-passfilter has only two taps which makes it a non-overlapping filter. Thisproperty is important for the hardware implementation.

Embedded Ordering

In the present invention, the coefficients generated as a result of thewavelet decomposition are entropy coded. In the present invention, thecoefficients initially undergo embedded ordering in which thecoefficients are ordered in a visually significant order or, moregenerally, ordered with respect to some error metric (e.g., distortionmetric). Error or distortion metrics include, for example, peak errorand mean squared error (MSE). Additionally, ordering can be performed togive preference to bit-significance spatial location, relevance fordatabase querying, and directionality (vertical, horizontal, diagonal,etc.).

The ordering of the data is performed to create the embeddedquantization of the codestream. In the present invention, two orderingsystems are used: a first for ordering the coefficients and a second forordering the binary values within a coefficient. The ordering of thepresent invention produces a bitstream that is thereafter coded with abinary entropy coder.

Bit-Significance Representation

Most transform coefficients are signed numbers even when the originalcomponents are unsigned (any coefficients output from at least onedetail filter are signed). In one embodiment, the embedded order usedfor binary values within a coefficient is by bit-plane. The coefficientsare expressed in bit-significance representation prior to coding.Bit-significance is a sign-magnitude representation where the sign bit,rather than being the most significant bit (MSB), is encoded with thefirst non-zero magnitude bit. That is, the sign bit follows the firstnon-zero magnitude bit rather than preceding all of the magnitude bits.Also, the sign bit is considered to be in the same bit-plane as the mostsignificant non-zero magnitude bit.

Bit-significance format represents a number using three sets of bits:head, tail, and sign. The head bits are all the zero bits from the MSBup to and including the first non-zero magnitude bit. The bit-plane inwhich the first non-zero magnitude bit occurs defines the significanceof the coefficient. The set of tail bits comprises the magnitude bitsafter the first non-zero magnitude bit to the LSB. The sign bit simplydenotes the sign, where a 0 may represent a positive sign and 1 mayrepresent a negative sign. A number, such as ±2^(n), with a non-zero bitas the MSB has only one head bit. A zero coefficient has no tail or signbits. Table 3 shows all possible values for form bit coefficientsranging from −7 to 8.

TABLE 3 Bit Significance Representation for 4 Bit Values 2's SignDecimal Complement Magnitude Bit-Significance −8 1000 −7 1001 1111 11 11 −6 1010 1110 11 1 0 −5 1011 1101 11 0 1 −4 1100 1100 11 0 0 −3 11011011 0 11 1 −2 1110 1010 0 11 0 −1 1111 1001 0 0 11 0 0000 0000 0 0 0 10001 0001 0 0 10 2 0010 0010 0 10 0 3 0011 0011 0 10 1 4 0100 0100 10 00 5 0101 0101 10 0 1 6 0110 0110 10 1 0 7 0111 0111 10 1 1

In Table 3, the bit significance representation shown in each columnincludes one or two bits. In the case of two bits, the first bit is thefirst one bit and is followed by the sign bit.

In the case where the values are non-negative integers, such as occurswith respect to the intensity of pixels, the order that may be used isthe bitplane order (e.g., from the most significant to the leastsignificant bitplane). In embodiments where two's complement negativeintegers are also allowed, the embedded order of the sign bit is thesame as the first non-zero bit of the absolute value of the integer.Therefore, the sign bit is not considered until a non-zero bit is coded.For example, using sign magnitude notation, the 16-bit number −7 is:1000000000000111On a bit-plane basis, the first twelve decisions will be “insignificant”or zero. The first 1-bit occurs at the thirteenth decision. Next, thesign bit (“negative”) will be coded. After the sign bit is coded, thetail bits are processed. The fifteenth and sixteenth decisions are both“1”.

Since the coefficients are coded from most significant bitplane to leastsignificant bitplane, the number of bitplanes in the data must bedetermined. In the present invention, this is accomplished by finding anupper bound on the magnitudes of the coefficient values calculated fromthe data or derived from the depth of the image and the filtercoefficients. For example, if the upper bound is 149, then there are 8bits of significance or 8 bitplanes. For speed in software, bitplanecoding may not be used. In an alternate embodiment, a bitplane is codedonly when a coefficient becomes significant as a binary number.

Coefficient Alignment

The present invention aligns coefficients with respect to each otherbefore the bit-plane encoding. This is because the coefficients in thedifferent frequency subbands represent different frequencies similar tothe FFT or the DCT. By aligning coefficients, the present inventioncontrols quantization. The less heavily quantized coefficients will bealigned toward the earlier bit-planes (e.g., shifted to the left). Thus,if the stream is truncated, these coefficients will have more bitsdefining them than the more heavily quantized coefficients.

In one embodiment, the coefficients are aligned for the bestrate-distortion performance in terms of SNR or MSE. There are manypossible alignments including one that is near-optimal in terms ofstatistical error metrics such as MSE. Alternately, the alignment couldallow a physchovisual quantization of the coefficient data. Thealignment has significant impact on the evolution of the image quality(or in other words on the rate-distortion curve), but has negligibleimpact on the final compression ratio of the lossless system. Otheralignments could correspond to specific coefficient quantization, Regionof Interest fidelity encoding, or resolution progressive alignment.

The alignment may be signaled in the header of the compressed data or itmay be fixed for a particular application or it may be fixed for aparticular application (i.e., the system only has one alignment). Thealignment of the different sized coefficients is known to both the coderand decoder and has no impact on the entropy coder efficiency.

The bit depths of the various coefficients in a two-level TS-transformand TT-transform decomposition from an input image with b bits per pixelare shown in FIG. 11. FIG. 12 is one embodiment of the multipliers forthe frequency band used for coefficient alignment in the presentinvention. To align the coefficients, the 1-DD coefficient size is usedas a reference, and shifts are given with respect to this size. A shiftof n is a multiplication by 2^(n).

In one embodiment, the coefficients are shifted with respect to themagnitude of the largest coefficient to create an alignment of all thecoefficients in the image. The aligned coefficients are then handled inbit-planes called importance levels, from the most significantimportance level to the least significant importance level. The sign isencoded with the last head bit of each coefficient. The sign bit is inwhatever importance level the last head bit is in. It is important tonote that the alignment simply controls the order the bits are sent tothe entropy coder. Actual padding, shifting, storage, or coding of extrazero bits is not performed.

Table 4 illustrates one embodiment of alignment numbers for aligningcoefficients.

TABLE 4 Coefficient Alignment 1-DD 1-DS,1-SD 2-DD 2-DS,2-SD 3-DD3-DS,3-SD 4-DD 4-DS,4-SD reference Left 1 Left 1 Left 2 Left 2 Left 3Left 3 Left 4

The alignment of different sized coefficients is known to both the coderand the decoder and has no impact on the entropy coder efficiency.

Note that coding units of the same data set may have differentalignments.

Ordering of the Codestream and the Context Model

FIG. 10 illustrates the ordering of the codestream and the orderingwithin a coding unit. Referring to FIG. 10, the header 1001 is followedby the coding units 1002 in order from top band to bottom. (The header1001 is optional in applications designed for a single image type.) Eachcoding unit includes most important data 1003, less important data 1004,and least important data 1005.

The context model determines both the order in which data is coded andthe conditioning used for specific bits of the data. Ordering will beconsidered first. The highest level ordering of the data has alreadybeen described above. The data is divided into “most important data”,referred to interchangeably herein as the most important chunk (MIC),which is coded losslessly in transform order and “less important data”which is referred to interchangeably herein as the least important chunk(LIC) and is coded in an embedded unified lossless/lossy manner.

The order that the coefficients during each bit-plane are processed arefrom the low resolution to the high resolution (from low frequency tothe high frequency). The coefficient subband coder within each bit-planeis from the high level (low resolution, low frequency) to the low level(high resolution, high frequency). Within each frequency subband, thecoding is in a defined order. In one embodiment, the order may be rasterorder, 2×2 block order, serpentine order, Peano scan order, etc.

In the case of a four level decomposition using the codestream of FIG.3, the order is as follows:

-   4-SS, 4-DS, 4-SD, 4-DD, 3-DS, 3-SD, 3-DD, 2-DS, 2-SD, 2-DD, 1-DS,    1-SD, 1-DD

One embodiment of the context model used in the present invention isdescribed below. This model uses bits within a coding unit based on thespatial and spectral dependencies of the coefficients. The availablebinary values of the neighboring coefficients and parent coefficientscan be used to create contexts. The contexts, however, are causal fordecodability and in small numbers for efficient adaptation.

The present invention provides a context model to model the bitstreamcreated by the coefficients in the embedded bit-significance order forthe binary entropy coder.

FIG. 37 shows the neighborhood coefficients for every coefficient of acoding unit. Referring to FIG. 37, the neighborhood coefficients aredenoted with the obvious geographical notations (e.g., N=north,NE=northeast, etc.). Given a coefficient, such as P in FIG. 37, and acurrent bit-plane, the context model can use any information from all ofthe coding unit prior to the given bit-plane. The parent coefficient ofthe present coefficient is also used for this context model.

The head bits are the most compressible data. Therefore, a large amountof context, or conditioning, is used to enhance compression. Rather thanusing the neighborhood or parent coefficient values to determine thecontext for the present bit of the present coefficient, the informationis reduced to two signaling bits described in conjunction with FIG. 13A.This information can be stored in memory or calculated dynamically fromthe neighbor or parent coefficient.

Implementing Embedding for Storage to Disk

One embodiment of the embedding scheme for the present invention isbased on the fact that when starting to encode data, the entire bandbuffer memory is full of data, such that there is no extra spaceavailable in the band for use as workspace memory. The present inventionwrites some of the less important data to memory to be embedded later.In the present invention, the data that is to be embedded is stored inmemory and this is the less important data. The more important data isencoded directly. The least important data comprises some number of theleast significant bits.

In one embodiment, if a portion of each coefficient is written back tomemory for encoding later, the head and tail bits must be known as wellas whether the sign bit has been done in order to ensure properencoding. In one embodiment, two or more signaling bits (e.g., 3, 4, 5,etc.) are used to indicate the head, tail and sign bit information.

In one embodiment, where 8-bit memory locations are used, two signalingbits indicate the head, tail and sign bit information. The use of twosignaling bits allows the least important 6 importance levels to bewritten back to memory with the two signaling bits. One signal bitindicates whether the most significant bit of the 6 importance levels isa head or tail bit. If the first signaling bit indicates that it is ahead bit, then the second signaling bit is the sign for the coefficient.On the other hand, if the first signaling bit indicates that the mostsignificant bit of the data written back to memory is a tail bit, thenthe second signaling bit is a free signaling bit which can indicateadditional tail information, such as, for example, whether the mostimportant tail bit is the first tail bit or a later tail bit.

FIG. 13A shows a coefficient divided into most important data 1301,referred to as the MIC, and less important data 1302, referred to as theLIC. In one embodiment, the MIC comprises the 6 higher order bits ofeach coefficient, while the LIC comprises the 6 lower order bits. Mostimportant data 1301 is sent to the context model to be coded immediatelyin coefficient order. No buffering in external memory is necessary forthis data. Less important data 1302 is written to memory (e.g., RAM) tobe coded later and embedded by order. In addition, the two signalingbits in the data written to memory. Signaling bit 1303 indicates whetherthe most significant bit in the data written to memory is a head bit.Signaling bit 1304 gives the sign for the coefficient or indicates ifthe first tail bit is contained in the data or not. Note that thesignaling bits may be stored in a concatenated fashion with lessimportant data 1302 or may be stored in another memory or memorylocation that is associated with the memory storing less important data1302 so that the signaling bits associated with each portion of acoefficient may be identified.

Examples in Table 5 show the use of the two signaling bits. The columnsof the body of Table 5 are intended to line up with the data types inFIG. 13A. Sign bits are denoted with “S”, tail bits are denoted with“T”, do not care bits are denoted with “x”, the value of the tail-on bitis denoted with “h” or “t”. In Table 5, h=0 and t=1 for the signalingbits. In an alternative embodiment, the conventions may be reversed. Inone embodiment, a sign bit in Table 5 of 0 indicates a positive sign,while a sign bit in Table 5 of 1 indicates a negative sign. An oppositeassignment may be used. Note the sign bit is always kept with the first“on” bit, so it can be coded at the same time for embedding.

TABLE 5 most important less important magnitude (lossless) (bitplaneembedded) signaling bits 1xxxx x 0000000 01TTTT h s 1xxxxx x 00000001TTTTT h s 1xxxxxx S 0000001 TTTTTT t 0 1xxxxxxx S 000001T TTTTTT t 11xxxxxxxx S 00001TT TTTTTT t 1 1xxxxxxxxx S 0001TTT TTTTTT t 1In Table 5 above, the “T” refers to the corresponding bit in thecoefficient and may be a 0 or 1.

In one embodiment, during decoding, when the most important data isdecoded, it is written to memory, and at the same time, the proper twosignaling bits are written to memory to initialize the memory forstoring the less important data. (Depending on the alignment of thecoefficients, some of the most important data may be stored in thesecond byte also.) With this initialization, decoding the less importantdata one bitplane at a time only requires reading and then writing onebyte (or less in some embodiments) per coefficient. When thecoefficients are read to be input to the inverse transform, they areconverted into a normal numerical form (e.g., two's complement form).

In addition to having “most important data” and “less important data”,there may also be data that is discarded or quantized during encoding.Coefficients are divided by a quantization scale factor 2^(Q−1).(Quantization of coefficients is described in the JPEG Standard.) In thepresent invention, the quantization is a power of two, since division isaccomplished by discarding bitplanes. For instance, Q=1 representsdivision by 1 and, thus, the coefficients don't change, while Q=2represents division by 2, which means one bit plane is discarded. Thesedivisions may be implemented using shifts (e.g., shift by one bitposition for Q=2). FIGS. 13B and 13C illustrate the format of the mostimportant and less important data when both quantization and coefficientalignment for different subbands is taken into account.

FIG. 13B shows the lossless case where no data is discarded. Followingthe convention of JPEG, this is called quantization Q=1, because theactual coefficient are divided by 1 (lossless). The most important datais indicated without cross-hatching, while the least important data iscross-hatched.

FIG. 13C shows the case where one bitplane of data has been discarded(i.e., Q=2) because discarding a bitplane is equivalent to division by2. The discarded bitplane is shown in black.

Note that in addition to what is shown in FIGS. 13B and C, the mostimportant data also includes the SS coefficients. Although coefficientsare shown for eight-bit data, the use of a reversible color space wouldrequire nine-bit data, increasing the size of chrominance coefficientsby one bit.

In the present invention, the sign bit context model comprises encodingthe sign after the last head bit. There are three contexts for the signdepending on whether the N coefficient is positive, negative or the signis not yet coded. Alternatively, one context can be used for the sign orthe sign can always be coded as 50%.

Order of Coding for Wavelet Coefficients

One embodiment of the ordering of coding for wavelet coefficients issummarized in the following pseudo-code:

code the most important data code the position of the first lessimportant bitplane with data for each less important data bitplane do  code a less important data bitplane

When the most important data is encoded, the first bitplane in the lessimportant data that is not comprised entirely of zero head bits isdetermined for each coefficient. This allows the encoder and decoder tolook-ahead over entire bitplanes of less important data. This isespecially useful for coding units of black and white data where all theinformation is in the K coefficients and the CMY coefficients are allzero. Not coding bitplanes individually helps compression ratio,particularly if R2(7) is the longest run length code available. (SeeU.S. Pat. Nos. 5,381,145 and 5,583,500 for a description of “R2” codes.)However, if the four parallel coding cores operate on componentssynchronously, the speed of processing is determined by the componentwith the most bitplanes to code; cores assigned to other components areidle during uncoded bitplanes.

A flow chart illustrating one embodiment of the operation of the pseudocode above is shown in FIG. 14. Referring to FIG. 14, the context modelbegins by coding the most important chunk (MIC) (processing block 1401).After coding the MIC, the processing logic codes the position of thefirst least important chunk (LIC) bitplane with data (processing block1402). This is for the entire coding unit. Either 0, 1, 2, 3, 4, 5 or 6bitplanes will contain data if there are 6 bitplanes in the LIC. Then,the processing logic sets a current LIC bitplane variable to the firstLIC bitplane with data (processing block 1403).

Next, a test determines if all the LIC bitplanes with data have beencoded (processing block 1404). If so, the process ends; if not, theprocessing logic codes a LIC bitplane (processing block 1405) and setsthe current LIC bitplane variable to the next LIC bitplane (processingblock 1406). Thereafter, processing loops back to processing block 1404.

Order of Coding for Most Important Data

One embodiment of the order of coding for the most important data is asfollows:

for each tree do  code the SS coefficient  perform MIC lookahead (orperform tree lookahead)  for each non-SS coefficient   for each bit(plane) with data do    code head or tail bit   if the coefficient isnot zero    code sign bit

The most important data is processed one wavelet tree at a time. Toreiterate, it is not embedded. An MIC look-ahead determines bitplanesthat are all zero head bits for all non-SS coefficients in the wavelettree. In one embodiment, a four-bit number is sufficient to identify thefirst bitplane to code individually. In an alternate embodiment shown inFIG. 15, one bit is used to indicate all non-SS coefficients 1501 of thesecond decomposition (hatched region) are zero and another bit toindicate all non-SS coefficients 1503 of the first decomposition arezero. These two bits are used in addition to the four bits used tospecify the first bitplane.

In an alternate embodiment, a tree lookahead may be used where the SScoefficients are coded and then for the whole tree, the first bit planewith non-zero head bits is coded.

To account for context revisit delay if conditioning is used for the SSand first bitplane coding, the actual coding/decoding of bits of the SScoefficient (which is 9 bits if a reversible color space is used) andthe look-ahead value can be alternated. If conditioning is not used,alternating is not required.

As discussed previously, the context model of the present invention usesa look-ahead. One embodiment of the look-ahead may be employed for themost important data, i.e. the most important chunk (MIC). In oneembodiment, as shown in FIG. 15, for each tree, 6 bits are used: 4 formaximum bit plane, 1 for level 0 all zero, 1 for level 1 all zero. Ifthe maximum bitplane is zero, then the two extra bits are redundant, butthis is not important. Otherwise, one adaptive coding decision is usedto decide “(isolated) zero/non-zero”. For non-zero coefficients, theymay be further specified by:

-   -   One M-ary operation to determine the value and sign of        coefficient. (Total: 2 cycles per coefficient).    -   One adaptive coding decision is used to decide “±1/not ±1”. A        second cycle is used to get the sign with the magnitude is 1 and        the sign and value for magnitudes greater than 1. (Total: 3        cycles per coefficient)    -   Similarly, “±1/not ±1”, “±2,3/not ±2,3”, and so on could be done        for a total of 4 cycles per coefficient.    -   The following procedure:

if all bitplanes in the MIC not are zero then  adaptively code adecision “−1, 0, 1” or “other”  if “−1, 0, 1” then adaptively code adecision “0” or “−1,+1” if “−1,+1” then specify sign bit else adaptivelycode a decision “−3, −2,2,3” or “other” if “−3, −2,2,3” then specify“−2,2” or “−3,3” with one bit specify sign bit else specify value withthe maximum number of bit that was determined for tree specify sign bitIt should be noted that “specifying” a bit or bits can be codingadaptively, coding at 50% probability or simply copying bits to thecoded data stream.

If all or most of the bitplanes are to be individually coded, somelevels of the transform may have unused bitplanes due toalignment—unused bitplanes are never coded. There are a number ofoptions for handling bit to context delay for the head and tail bits.One method is to do three coefficients in alternation: a DD, a SD andthe a DS. The sign bit for non-zero coefficients can be coded at the endof the coefficient—since all of the most important data is alwayslossless, exactly following the first “on” bit is not necessary.

One embodiment of flow chart illustrating the pseudo code for coding themost important chunk is shown in FIG. 16. Referring to FIG. 16, theprocess begins with the processing logic setting the current tree to thefirst tree (processing block 1601). Then, the processing logic codes theSS coefficient (processing block 1602). After coding the SS coefficient,the processing logic codes the position of the first bitplane with datain the MIC of the tree (processing block 1603) or performs the MIClookahead.

Then, the processing logic tests whether the MIC of the entire tree iszero (processing block 1604). If the MIC of the entire tree is zero, theprocessing continues at processing block 1614; otherwise, processingtransitions to processing block 1605 where the processing logic sets thecurrent coefficient to the first non-SS coefficient in the tree.

After setting the current coefficient to the first non-SS coefficient inthe tree, the processing logic sets the current bitplane to the firstbitplane with data (processing block 1606). Then, the processing logiccodes a bit of the current coefficient in the current bitplane(processing block 1607). Afterwards, the processing logic tests whetherall the bitplanes have been coded (processing block 1608). If all thebitplanes have not been coded, the processing logic sets the currentbitplane to the next bitplane (processing block 1609) and transitions toprocessing block 1607. If all the bitplanes have been coded, theprocessing logic tests whether the current coefficient is zero(processing block 1610). If the current coefficient is not zero, theprocessing logic codes the sign bit (processing block 1611) andprocessing transitions to processing block 1613. If the currentcoefficient is zero, then the processing logic transitions to processingblock 1613.

At processing block 1613, the processing logic tests whether allcoefficients in the tree have been coded. If all the coefficients in thetree have not been coded, then the processing logic sets the currentcoefficient to the next coefficient in the tree (processing block 1612)and the processing transitions to processing block 1606. If all of thecoefficients in the tree have been coded, then the processing logictests whether all trees have been coded (processing block 1614). If allthe tree have been coded, processing ends; otherwise, processingtransitions to processing block 1615 where the processing logic sets thecurrent tree to the next tree and the processing transitions toprocessing block 1602.

FIG. 17 is a block diagram of one embodiment of the formatting unit andcontext model used during the most important data coding pass. Referringto FIG. 17, a barrel shifter 1701 is coupled to receive the magnitude ofthe coefficient and a quantization level that was used during encodingto prevent the most important data from exceeding the minimum diskbandwidth, ensuring lossless decompression. Thus, the quantization levelcontrols barrel shifter 1701. In one embodiment, barrel shifter 1701shifts the magnitude bits by 0, 1, 2 or 3 to support quantizations of 1,2, 4 or 8. In an alternative embodiment, a lower or higher number ofquantizations are supported, such as only two quantizations.

The output of barrel shifter 1701 comprises the lower order sixbitplanes which is the less important data and the rest of the higherorder bits which is the most important data. In an alternate embodiment,a simple separation mechanism is used to produce these two outputs.

Both outputs of barrel shifter 1701 are input to first bitplane unit1702, which determines which bit planes have data in them. First bitplane unit 1702 is used to find the bitplane with first “on” bit for theentire coding unit (see FIG. 10) for use when processing the lessimportant data. Another bit plane unit 1706 is coupled to receive themost important data output from barrel shifter 1701 as well. Firstbitplane unit 1706 is used for each tree when processing the moreimportant data. One embodiment of the first bitplane unit is describedbelow with reference to FIG. 18.

Barrel shifter 1701 is also coupled to comparison units 1703 and 1704,which perform two comparisons on the most important data to generate thetwo bit signaling information for the less important data. Comparisonunit 1703 determines if the most important data is equal to 0, therebyindicating whether a tail bit has occurred already (i.e., whether codingis in the tail yet). The output of comparison unit 1703 is the tail-onbit. Comparison unit 1704 determines whether the most important data isequal to 1. If the most important data is equal to 1, then from Table 5above the output is 0. The output of comparison unit 1704 is coupled toone input of multiplexer (MUX) 1705. The other input to mux 1705 iscoupled to receive the sign bit. A select input of mux 1705 iscontrolled by the output of comparison unit 1703, such that if theoutput of comparison unit 1703 indicates that the bit is a tail bit,then the output of mux 1705 is a “first tail” bit 1304. However, if theoutput of comparison unit 1703 indicates that the bit is the head bit,then mux 1705 is controlled to output the sign.

In one embodiment, the comparison units 1703 and 1704 may be implementedusing simple bit comparators.

A memory 1707 is coupled to receive the sign bit, the most importantdata output from barrel shifter 1701 and the output of bit plane unit1706. Memory 1707 is used to delay coefficients so that parent andneighboring information is available for the conditioning. Theorganization of memory 1707 is discussed below.

Context models (CM) 1710–1712 provide conditioning for the sign, head,tail and other bits. Each of these context models is described in below.

FIG. 18 illustrates one embodiment of a first bitplane unit. Referringto FIG. 18, first bitplane unit 1800 comprises an OR gate 1801 coupledto receive a coefficient and a feedback from the output of a register1802. The output of OR gate 1801 is coupled to the input of register1802. Register 1802 is controlled by a start of tree/coding unit resetindication. The output of register 1802 is coupled to a priority encoder1803. The output of the priority encoder 1803 is the output of firstbitplane unit 1800.

At the start, register 1802 is cleared. Each bit of register 1802 isORed with each bit of the input coefficient using OR gate 1801. For eachbit of the coefficient that is 0, the value of register 1802 remains itscurrent value, which is output to priority encoder. For each bit of thecoefficient that is a 1 (e.g., the first one), the output of OR gate1801 to register 1802 is a 1, which is output to the priority encoder1803. The priority encoder 1803 then locates the first 1, which is thefirst bitplane of the coefficient that has a 1.

Order of Processing for Less Important Data

Each bit plane for the least important data is processed as follows:

for each tree do  for each coefficient do   if start of look-aheadinterval    do look-ahead   if look-ahead not active    code head ortail bit    if first “on” bit     code sign bit

One embodiment of the process of coding a LIC bitplane is shown in theflow chart of FIG. 19. The process of coding an LIC bitplane begins withprocessing logic setting the current tree to the first tree (processingblock 1901). Then, the processing logic sets the current coefficient tothe first non-SS coefficient in the tree (processing block 1902). Aftersetting the current coefficient to the first non-SS coefficient in thetree, the processing logic tests whether the coding is at the start of alook-ahead interval (processing block 1903). If the coding process is atthe start of a look-ahead interval, the processing logic performs alook-ahead (processing 1904) and processing continues at processingblock 1905. If the coding process is not at the start of a look-aheadinterval, processing logic transitions directly to processing block 1905and determines is look-ahead is active.

If look-ahead is active, processing continues at processing block 1909where the processing logic determines if all the coefficients in thetree are coded. If all the coefficients in the tree are coded,processing continues at processing block 1913; otherwise, the processinglogic sets the current coefficient to the next coefficient in the treeafter the look-ahead interval (processing block 1910) and the processingtransitions to processing block 1903.

If the look-ahead is not active, the processing logic codes the head ortail bit (processing block 1906) and then tests whether the firstnon-zero bit has been received (processing block 1907). If the firstnon-zero bit has not been received, processing continues at processingblock 1911. If the first non-zero bit has been received, processingcontinues at processing block 1908 where the processing logic codes thesign bit and processing then transitions to processing block 1911.

At processing block 1911, the processing logic determines whether allcoefficients in the tree have been coded. If all coefficients in thetree have not been coded, the processing logic sets the currentcoefficient to the next coefficient in the tree (processing block 1912)and transitions to processing block 1903. If all the coefficients in thetree have been coded, the processing transitions to processing block1913 where the processing logic tests whether all trees have been coded.If all the trees have not been coded, processing logic sets the currenttree to the next tree (processing block 1914) and processing continuesat processing block 1902. If all the trees have been coded, theprocessing ends.

Processing a wavelet tree at a time may not be important, but since thetransform causes data to be read and written in that order, it may beconvenient. If data is processed by wavelet trees, bit to context delaycan be accommodated by alternating between DD, SD and DS coefficients(alternating between sub-trees). Otherwise, one subband at a time can becoded. Regardless of the order chosen, unused head/tail bits due toalignment of different subbands are never coded and do not require idlecycles.

FIG. 20 is a block diagram of one embodiment of the look-ahead andcontext models for less important data. In one embodiment, the mostimportant data and the less important data use the same context models(CM) that provide conditioning for the sign, head and tail bits.

Referring to FIG. 20, context models 2001–2003 are coupled to the inputdata. A sign context model 2001 is coupled to receive the tail-on bit, asign/first tail bit signal, and the data. The head bit context model2002 is coupled to receive the tail-on bit and the data. The tail bitcontext model 2003 is coupled to receive the tail-on bit, a sign/firsttail bit signal, and the data. In response to their inputs, each ofcontext models 2001–2003 generate a context.

The contexts generated by context models 2001–2003 are coupled to inputsof mux 2004. Mux 2004 is controlled by the previous bits and the bitsignificance representation itself. The head content model 2002 is useduntil a 1 bit is seen at the data input. The sign content model 2001 isused when the last bit was the first 1 bit of the head. Thereafter, thetail content model 2003 is used.

The output of mux 2004 is coupled to “=head?” unit 2005 andfirst-in/first-out (FIFO) buffer 2006. The “=head?” unit 2005 tests ifthe current context is a head bit context with zero head bits in theneighborhood and parent. If all the context are in the head, a signalfrom “=head?” unit 2005 clears FIFO 2006.

The contexts and results are buffered in FIFO 2006 or other memory forthe look-ahead interval. At the end of the interval, if necessary alook-ahead decision and/or individual decisions are coded. If thecoefficients are processed one wavelet tree at a time, the FIFO forlook-ahead can be a single FIFO used for all subbands or multiple FIFOscan be used, one for each subband.

Note that if it was convenient to reduce multiplexing, the mostimportant data could use look-ahead too. However, it may be somewhatredundant to use both look-ahead and first bitplane for each tree.

If a core assigned to one component codes a sign bit, cores assigned toany other components that do not code a sign bit at the same bitplanewill be idle. Therefore, up to four clock cycles could be used for signbits if each core codes a sign bit on a different bitplane. In oneembodiment, there are up to six head or tail bits per coefficient.

One possible timing problem is that the most important chunk compressessufficiently well that the disk is idle during the decoding of a portionof that data. If there is sufficient memory bandwidth to the bandbuffer, look-ahead may be used to process the most important datafaster. Then the less important data can get a head start. Also, itwould be good if the disk had a burst transfer rate that was higher thanthe maximum sustained rate. Hard disks normally have a significantbuffer, and perhaps reading ahead into this buffer would eliminate theidle time.

Conditioning a Portion of the Context Model

The conditioning used in the context model is dependent on hardware costversus compression trade-offs. Therefore, in the following sections,many options for conditioning are presented for designers to consider.

Context Model for SS Coefficients

In one embodiment of the context model, SS coefficients are not coded.Since they make up only 1/256th of the original data, there is littlegain to coding them. If coding them is desired, they could be handled byGray coding, conditioning on previous bit in the same coefficient,and/or on corresponding bit in the previous coefficient.

Context Model for First Bitplane Information

The four bits of first bitplane information for the most important dataeach wavelet tree can be treated in a similar fashion to the SScoefficients. The increase the size of the original data by only1/512th. In one embodiment, they can be uncoded due their small sizecompared to the original data or undergo gray coding and someconditioning.

Similarly, if six bits are used according to FIG. 15, they can betreated like SS coefficients.

Context Model for Head Bits

FIG. 21 is a block diagram of one embodiment of the context model whichprovides the conditioning for head bits. Referring to FIG. 21, contextmodel 2100 contains shift registers like those found in a bitplanecontext model. An important difference is that instead of using previouscoefficient bits form the current bitplane, conditioning is based ontail-on information which uses all previous bitplanes and previouslycoded information in the current bitplane. Also, some bits to identifythe bitplane coded or the group of bitplanes coded and the subband orgroup of subbands coded rate generated by the importance level andsubband bucketing.

Referring to FIG. 21, the context model comprises two inputs, thecurrent significant level 2110 and the coefficients from memory 2111.The current significance level 2110 is coupled to inputs of the tail-oninformation/bit generator(s) block 2101 and the importance level andsubband bucketing block 2102. The coefficients from memory are alsocoupled to block 2101 and the registers 2103–2106.

Block 2101 takes the coefficients and determines if there is a one bitor not. In one embodiment, 2101 also determines out where the one bitis. The output of block 2101 is one or two bits based on the tail-oninformation. In one embodiment, the tail-information relates whether ornot the first non-zero magnitude bit has been observed (e.g., whetherthe first “on-bit” has been observed) and, if so, about how manybit-planes ago. Table 6 describes the tail-information bits.

TABLE 6 Definition of the tail information Tail Definition 0 no on-bitsis observed yet 1 the first on-bit was on the last bit-plane 2 the firston-bit was two or three bit-planes ago 3 the first on-bit was more thanthree bit-planes agoFrom the 2-bit tail information, a 1-bit “tail-on” value is synthesizedto indicate whether the tail information is zero or not. In oneembodiment, the tail-information and the tail-on bits are updatedimmediately after the coefficient has been coded. In another embodiment,updating occurs later to allow parallel context generation.

In addition, the two bits may be used to indicate the importance levelbeing coded. The first two bit planes use value 0, the second two 1, thethird two 2, and the remaining bit-planes 3. In addition, there is arun-length encoding of the bits that are all zero head bits.

The 10 bits of context for the head bits includes the 2 bits ofinformation each from the parent and the West coefficients, 1 bit ofinformation from each of the North, East, SouthWest, and Southcoefficients, and 2 bits of importance level information.

In one embodiment, the tail-information is not used for some or allfrequency bands. This allows a frequency band to be decoded withoutpreviously decoding its parent.

In another embodiment, the assignment of the bit planes of eachfrequency band to importance levels uses one alignment. Thedetermination of tail-on information of the parent uses a secondalignment, which uses fewer bitplanes of the parent than have actuallybeen coded. This allows some bitplanes of a frequency band to be decodedwithout decoding the corresponding bitplanes of the parent in the sameimportance level (see FIG. 38). For example, an image may be encodedwith pyramidal alignment, but with parent tail-on information based onMSE alignment (see FIG. 39). This allows the decoder to decode inpyramidal alignment, to simulate MSE alignment, or to simulate anyalignment between pyramidal and MSE.

Referring back to FIG. 21, the outputs of block 2101 are coupled to theinputs of registers 2103–2106. Registers 2103–2106 accumulate theneighborhood data. For instance, the above/left shift register maintainsbits during the line that is immediately above the current coefficient.The current shift register contains the bits in the current line ofcoefficients, while the below/right shift register 2105 contains thelines from the line immediate below the shift register. Lastly, parentregister 2106 maintains the parent data. The outputs of the shiftregisters form the context.

The output of importance level and bucketing block 2102 may also be usedfor a context. Such would be part of the context when the subbands anddifferent levels are to be coded to the same context. If that is thecase, the output of block 2102 is combined with the outputs of theregisters 2103–2106 to form the context. If not, the context onlycomprises the outputs of registers 2103–2106.

Also output from the context model 2100 is a bit.

Coding can be done by alternating between DD, SD and DS coefficients toallow for the bit to context delay for use of data from the currentbitplane (alternating between sub-trees).

Note that memory is needed to store coefficients needed for conditioning(see FIG. 17). The memory usage for one embodiment of the context modelwith conditioning on all neighbors and parents is shown in FIG. 22. Ashort seam transform order is assumed. (External memory could be used tosupport a long seam transform order. This would require both additionalmemory storage and bandwidth).

Conditioning on high level parents is especially costly. The level 4 DDcoefficient for a given tree is not computed until 16 trees later thanmost of the level 1 DD coefficients for that tree. Also, storing entirecoefficients to be coded later (unshaded in FIG. 22) is much more costlythat only storing tail-on information for later use in conditioning(cross hatched in FIG. 22). Conditioning only on “west” information thatis in the same tree and on parents that are generated without data from“west” trees would greatly reduce the amount of memory required. Whenparent or west information was not available, copying the informationfrom the north or east is useful.

Context Model for Sign Bits

The context model that provides conditioning for sign bits is simple. Ifthe sign of the above pixel is known, it is used for conditioning. Ifthe sign bit for the above pixel is unknown, then the bit is uncoded(R2(0) is used. Alternatively, no coding (R2(0)) can be used for allsign bits.)

FIG. 23 is a block diagram of one embodiment of the context model forsign bits. Referring to FIG. 23, a mux 2301 receives a north sign bit2303 and a 0 bit 2304 (hardwired) and is controlled by a north tail-onbit 2302 to output the north sign bit 2303 if the north tail-on bit 2302is a 1; otherwise, mux 2301 outputs a 0. Thus, the north pixel suppliesthe north tail-on bit 2302 and north sign bit 2303 to provide a contextfor the pixel south of the north pixel.

Context Model for Tail Bits

No conditioning is used for tail bits. In one embodiment, a fixedprobability state is used, and no probability update is used. Table 7shows three options for codes to use for tail bits. The second optionwhich uses R2(1) and R2(0) is a good choice.

TABLE 7 Probability states (codes) used for tail bits bit of tail 1 2, 34, . . . Option 1 R2(1) golden ratio code R2(0) Option 2 R2(1) R2(0)R2(0) Option 3 R2(0) R2(0) R2(0)

In one embodiment, the golden ratio code, which is good forprobabilities of M≅60%, L≅40% is:

input codeword MMM 00 MML 110 ML 01 LM 10 SS 111Context Bin Summary

The minimum number of context bins that could be used in the system isas follows. SS, first bitplane for each tree, sign and tail bits all arenot coded (the code is used R2(0)). Although no PEM state or mostprobable symbol (MPS) bit needs to be stored, there must be logic toselect the R2(0) code. Therefore, depending on how this is counted, thehardware cost is zero or one context bin. Adaptive coding should be usedfor head bits. For less important data, since one bitplane at a time iscoded, conditioning on the bitplane is not important. For most importantdata, the first bitplane for each wavelet tree may reduce the numberbitplanes sufficiently that conditioning on the bitplane is notimportant. It is less clear what the usefulness of conditioning on thesubband is, but this will also be ignored in this minimum contextexample. The tail-on bits of three neighbors and one parent could beused for a total of four bits (16 context bins). One additional contextbin can be used for look-ahead. (It may be more convenient to map twohead context bins together to make room for the look-ahead so the memorysize is still a power of 2).

With four cores (requiring replicating contexts four times) and twocontext memory banks per core, the minimum number of context bins to usewould be between 128 and 144 depending on how “not coded” contexts arecounted and whether two head context bins were mapped together.

A system with a generous amount of conditioning is as follows:

-   -   For SS (9-bit) and first bitplane (4 bit), use 4 context bins        per bit, for a total of 52 context bins. (These could be divided        into banks, they do not have to be duplicated).    -   Tail bits are not coded, but both R2(0) and R2(1) are used.        Depending on how this is counted, this costs 0, 1, or 2 context        bins.    -   Two adaptive contexts and one “no code” context is used for the        sign bits.    -   The head bits could use 8 bits from neighbors/parent and 2 bits        for subband/bitplane information (1024 context bins).    -   One context is used for look-ahead.

An alternative embodiment of a context model, including an embodiment ofa sign/magnitude unit that converts input coefficients into asign/magnitude format, is described in U.S. patent application Ser. No.08/498,695, filed Jun. 30, 1995 and entitled “Method and Apparatus ForCompression Using Reversible Wavelet Transforms and an EmbeddedCodestream” and U.S. patent application Ser. No. 08/498,036, filed Jun.30, 1995 and entitled “Reversible Wavelet Transform and EmbeddedCodestream Manipulation” and also U.S. patent application Ser. No.08/642,518, filed May 3, 1996 and entitled “Compression andDecompression with Wavelet Style and Binary Style Including Quantizationby Device-Dependent Parser” and U.S. patent application Ser. No.08/643,268, filed May 3, 1996 and entitled “Compression/DecompressionUsing Reversible Embedded Wavelets”.

The context model provides contexts for entropy coding of the data. Inone embodiment, all the entropy coding performed by the presentinvention is performed by binary entropy coders. A single coder may beused to produce a single output code stream. Alternately, multiple(physical or virtual) coders may be employed to produce multiple(physical or virtual) data streams.

M-Ary Coding for LIC

FIG. 24 illustrates the use of M-ary coding for the LIC. The use ofM-ary for a reduced coding operates as a lookahead (as shown). At first,the state of the next eight coefficients is examined. If there isanything in the head, entropy coding is performed on the head bits, suchthat all head bits on an entropy coded, one per cycle, until all headbits in the 8 are coded. Referring to FIG. 24, head bits which are 1 arecoded in the first and third cycles, while head bits that are 0 arecoded in the second and fourth cycles. Once all of the head bits areentropy coded, the sign and tail bits are coded in the same cycle. Forexample, in FIG. 24, all the sign and tail bits that followed a head bitthat is 1 are coded in the fifth cycle. In this manner, the overallnumber of cycles is reduced.

A Printing System Application of the Present Invention

FIG. 25 is a block diagram of one embodiment of the front end of aprinter. Referring to FIG. 25, a renderer 2501 receives data in the formof a page description language or display list. Renderer 2501 maycomprise raster image processing. For each location (e.g., spot),renderer 2501 determines its color (e.g., black/white, 8-bit-RBG values,8 bit CMYK values depending on the application). The output of renderer2501 is a set of pixels formatted into bands and stored in band buffer(memory) 2503.

In an alternative embodiment, data from a Page Description Language(PDL) such as Adobe Postscript™ or Microsoft Windows™ GDI is renderedinto a display list. The display list is used to generate bands ofpixels. In this embodiment, it is assumed that the pixels representcontinuous-tone values, and any halftoning or dithering required by theprint engine will be performed after decompression.

In the present invention, the memory used for the band buffer 2503 isalso used for workspace for compression (without increasing the memoryrequired). This dual use is described in more detail below.

Compressor 2504 compresses each band of pixels is compressed. If theinput to compressor 2504 are halftoned or dithered pixels, compressor2504 would still work but the compression achieved would likely be poorwith wavelet processes. A binary context model can be used on halftonedor dithered pixels. Compressor 2504 writes the compressed data to disk2505. Disk 2505 may be a hard disk. In an alternative embodiment, disk2505 may be random access memory (RAM), Flash memory, optical disk,tape, any type of storage means, any type of communication channel.

FIG. 26 is a block diagram of one embodiment of the back end of theprinter. Referring to FIG. 26, the back end of printer 2500 comprises adecompressor 2602 coupled to disk 2505, a band buffer (memory) 2603 anda print engine 2604. The decompressor 2602 reads compressed data fromthe hard disk 2505 and decompressed. The decompressed data is stored inband buffer (memory) 2603 in the form of pixels. Band buffer 2603 may besame memory as band buffer 2503 to operate as workspace for compressor2504. Decompressor 2602 keeps band buffer 2603 sufficiently full so thatpixels can be sent to print engine 2604 in real-time.

FIG. 27 is an alternative embodiment that includes an optionalenhancement. Referring to FIG. 27, pixels from decompressor 2602 go toband buffer 2603 via enhancement block 2705, while other information,which is the information that is not yet pixels (partial coefficients),is sent directly to band buffer 2603. Enhancement block 2705 may performsuch functions as interpolation, smoothing, error diffusion, halftoningand/or dithering.

The bandwidth needed between decompressor 2602 and band buffer 2603allows decompressor 2602 to first write transform coefficients to bandbuffer 2603, access band buffer 2603 to obtain certain coefficients andperform the inverse transform on such coefficients and then write themback to band buffer 2603. Note that band buffer 2603, as a work spacememory, may be small. For instance, if a full page image is 64 megabytesand band buffer 2603 is 16 megabytes, it would still be considered asmall work space memory.

In one embodiment, A4 images at 400 dpi with 32 bits/pixel (four 8-bitcomponents, CMYK) about 8 pages/minute require a data rate ofapproximately 8 Mbytes/s from band buffer 2603 to print engine 2604. Thetransfer rate of an exemplary hard disk is around 2 Mbytes per second(e.g., 1.7–3.5 Mbytes/s). Therefore, a typical compression ratio ofabout 4:1 is required to match the bandwidth of disk 2601 to thebandwidth of the printer. In one embodiment, compressor 2504 in FIG. 25and decompressor 2602 in FIG. 26 or 27 are contained a single integratedcircuit chip.

FIG. 28 is a block diagram of one embodiment of an integrated circuit(IC) chip containing the printer compression/decompression. Referring toFIG. 28, pixel data interface 2801 is coupled to the band buffer (notshown). Pixel data interface 2801 generates addresses for reading andwriting pixels from and to the band buffer, respectively. An optionalreversible color space 2802 may be included to perform a reversiblecolor space conversion. Coefficient data interface 2804 generatesaddresses for reading and writing coefficients and properly assemblestwo byte coefficients. Coefficient data interface 2804, along with pixeldata interface 2801, handle any line buffering or coefficient bufferingthat is required to be in external memory. Coefficient data interface2804 and the use of a reversible color space is discussed in greaterdetail below.

It should be noted that the double arrows imply that data may flow ineither direction. For instance, in compressing the data, data moves fromleft to right through different components of the IC chip. On the otherhand, when decompressing data, the data moves from right to leftgenerally.

When coding data, pixel data from pixel data interface 2801, orreversible color space 2802 (if included), are received by wavelettransform block 2803 which performs the wavelet transform on the pixeldata. In one embodiment, the transform performed by wavelet transformblock 2803 is an overlapped wavelet transform. It provides energycompaction for both lossless and lossy image compression. For lossycompression, the block boundary artifacts that plague JPEG are avoided.The filter coefficients, when properly aligned, are normalized so thatscalar quantization provides good lossy compression results. In oneembodiment, the wavelet transform block 2803 performs a 2,6 transform.In another embodiment, wavelet transform block 2803 performs a 2,10transform. Wavelet transform block 2803 may perform other well-knowntransforms. Various implementations of wavelet transform block 2803 arediscussed in greater detail below.

The coefficients output from wavelet transform block 2803 may be writtenback to the memory (e.g., the band buffer) via coefficient datainterface 2804 for coding later. In one embodiment, the data that iswritten back to memory is less important data and will be described indetail below. Such data is later read back into the IC chip and coded.

The coefficients output from wavelet transform block 2803 or receivedvia coefficient data interface 2804 are provided to context model 2805.Context model 2805 provides the context for encoding (and decoding) datausing encoder/decoder 2806. In one embodiment, context model 2805supports sending data directly to coding. In this way, context model2805 operates as the most important context model. An architecture forimplementing various context models has been described above.

In one embodiment, encoder/decoder 2806 comprises a high speed parallelcoder. The high-speed parallel coder handles several bits in parallel.In one embodiment, the high speed parallel coder is implemented in VLSIhardware or multi-processor computers without sacrificing compressionperformance. One embodiment of a high speed parallel coder that may beused in the present invention is described in U.S. Pat. No. 5,381,145,entitled “Method and Apparatus for Parallel Decoding and Encoding ofData”, issued Jan. 10, 1995.

In alternative embodiments, the binary entropy coder comprises either aQ-coder, a QM-coder, a finite state machine coder, etc. The Q andQM-coders are well-known and efficient binary entropy coders. The finitestate machine (FSM) coder provides the simple conversion from aprobability and an outcome to a compressed bit stream. In oneembodiment, a finite state machine coder is implemented using tablelook-ups for both decoder and encoder. A variety of probabilityestimation methods may be used with such a finite state machine coder.In one embodiment, the finite state machine coder of the presentinvention comprises a B-coder defined in U.S. Pat. No. 5,272,478,entitled “Method and Apparatus for Entropy Coding”, issued Dec. 21,1993.

The output of encoder/decoder 2806 is coupled to coded data interface2807 which provides an interface to the disk or other storage medium, oreven another channel.

Coded data interface 2807 sends and receives coded data from disk. Inone embodiment, if the SCSI controller is included in the chip, it maybe implemented at this point. In another embodiment, coded datainterface 2807 communicates with an external SCSI controller. Non-SCSIstorage or communication may be used.

During decompression, coded data is received by encoder/decoder 2806from the disk (or other memory storage or channel), via coded datainterface 2807, and is decompressed therein using contexts from contextmodel 2805. The coefficients that result from decompression are inversetransformed by wavelet transform block 2803. (Note that although wavelettransform block 2803 performs both forward and inverse transforms in oneembodiment, in other embodiments, the two transforms may be performed byseparate blocks.) The output of transform block 2803 comprises pixelsthat undergo any optional color space conversion and are output to theband buffer via pixel data interface 2801.

The basic timing of the system during printing is shown in FIG. 29.Referring to FIG. 29, the coded data for each coding unit is read fromdisk. As much data as possible is read, and after a short delaycoefficients are decoded. After decoding is complete, the inversewavelet transform is computed. After the transform is complete, pixelscan be sent to the print engine. Note that the cross-hatching in FIG. 29indicates when different actions occur for a specific coding unit.

Embedding Coefficients for Storage to Disk

FIG. 10 shows the organization of the coded data in the presentinvention. Referring to FIG. 10, the most important data 1003 is codedin coefficient order (not embedded) immediately after being transformed.Therefore, this data does not have to be buffered. In one embodiment,the amount of most important data 1003 is limited so that it can alwaysbe read from disk.

Some amount of less important data 1004 is buffered, embedded andwritten to disk in order of importance. The amount of data that may bebuffered, embedded and written is determined on the transfer time. Thatis, the system reads the data until the transfer time from the disk hasexpired. The transfer rate of the disk determines how much of data iskept. These rates are known and are dependent on physicalcharacteristics of a particular transfer.

For hard to compress images, some data may be discarded during encodetime. The data is shown as least important data 1005. In the case thatthere is no possibility that the least important data can be read giventhe best case disk transfer rate, there is no reason to store that dataon disk. For many and perhaps most images, no data would be discarded.

The ordering of coded data and how it is accomplished is described ingreater detail above.

In the following, band buffer management during the compression anddecompression is discussed, followed by a description of an embeddingscheme for the coded data. Hardware implementations of the transform,the context model, and parallelism with the encoder/decoder are alsodescribed.

Pixel and Coefficient Interfaces

FIG. 30 illustrates one possible embodiment of how pixel data isorganized. Referring to FIG. 30, a page (image) 3000 is divided intobands 3001–3004. In one embodiment, page 3000 may comprise a pagedescription language or display list description of a page that is usedto generate pixels for the individual bands. In one embodiment, each ofbands 3001–3004 is individually rasterized using display listtechnology. Each of bands 3001–3004 is further divided into coding units(e.g., 3001A–D).

An advantage of using multiple coding units per band is that portions ofthe band buffer can be used in rotation as workspace duringdecompression (similar to ping-pong buffering). In other words, oneportion of the pixels can be decompressed, stored in the band buffer andsent to the printer, while a second portion of the band buffer can beused as workspace to store coefficients while decoding, with a thirdportion of the buffer being used to store the pixels that correspond tothe coefficients.

FIG. 31 illustrates a band buffer 3101 of page 3100. Band buffer 3101comprises coding units 3101A–D. Coding units 3101A and 3101B act as aworkspace for the decompressor by storing coefficients. Coding unit3101C stores pixels to be output to the printer (or channel), whilecoding unit 3101D acts as workspace for the decompressor by storing thenext pixels.

The portions of band buffer 3101 can be used in rotation as the entirepage 3100 is printed. For instance, for the next coding unit, the pixelsin coding unit 3101D are the pixels to be output to the printer. Whenthat occurs, coding units 3101B and 3101C will be used as workspace forthe decompressor to store coefficients. Also at that time, coding unit3101A will be used as the workspace for the decompressor to store thenext pixels to be output to the printer.

In the present invention, the coefficients are bigger than pixels.Therefore, twice as much memory is allocated to the workspace memory. Inan alternate embodiment, the bands may be divided into more or lesscoding units. For instance, in one embodiment, the bands may be dividedinto eight coding units each.

Memory Bandwidth

Together, the pixel data interface and the coefficient data interfacemanage the band buffer memory efficiently. If fast page mode DRAM,Extended Data Out (EDO) DRAM, or other memories which favor consecutiveaccesses is used, then these interfaces transfer data from consecutiveaddresses in long enough bursts to make efficient use of the potentialbandwidth of the memory. Some small buffers may be needed to supportburst accesses to consecutive addresses.

FIG. 32 illustrates a timing diagram of decoding that illustratesconcurrent memory access requirements. Referring to FIG. 32, thebandwidth required for decoding is as follows. Recall that in oneembodiment, a 2 MHz pixel-clock, a 8 MHz component-clock and a 32 MHzdecoder clock are used, and that the print engine requires 1byte/component-clock, the transform reads 2 bytes per coefficient andwrites 1 byte per component. If the transform is performed in half thecoding unit time, it would require 6 bytes/component-clock. The speed ofthe transform is limited by memory bandwidth, not computation time. If abandwidth of 24 bytes/component-clock is available, the transform couldbe computed in one-eighth of the coding unit time. The transform mayrequire additional bandwidth if external memory is used for seams. Inone embodiment, the decoding of coefficients requires writing two bytesper component-clock for the most important part of coded data. Decodingrequires a read and a write of one byte per component-clock for eachbitplane of the less important part of the coded data. Note this may beless in some embodiments. Bandwidths of 4 bytes per component-clock and24 bytes per component-clock respectively would be required if bothoperations took half the coding unit time. Additional bandwidth mightrequired if external memory was used for context seam information.

In one embodiment, the maximum burst mode transfer rate is 4 memoryaccesses per component-clock (one access per coder-clock). Therefore,with a 32-bit data bus, the maximum transfer rate is somewhat less than16 bytes/component-clock. With a 64-bit data bus, the maximum transferrate is somewhat less than 32 bytes/component-clock.

Reduction of LIC Memory Bandwidth Requirements

Each bit of each coefficient in the LIC requires a read and a write ofexternal memory during decoding. (Encoding only requires a read). Thesememory accesses account for the majority of the memory bandwidthrequired. In one embodiment, instead of storing each LIC coefficient in8 bits, the present invention stores the coefficients using less than 8bits when possible to reduce the bandwidth requirements.

Table 8 shows how much memory is required to store LIC coefficients forthe decoding of each bitplane. Referring to Table 8, when doing the MIC,one bit per coefficient is written, which is the tail-on bit. What iswritten for bit plane 5 is read back for bit plane 4: 2–3 bits thatinclude, the tail-on bit, what bit 5 was and if bit 5 was a 1, then asign bit. The percentage indicates for each bit planes which percentageof coefficients are participating. This may be made clearer by lookingat FIG. 13B. Referring to FIG. 13B, bitplane 5 has coefficients from allsubbands participating because all coefficients from the DD1 to the DS4and SD4 subbands have data in bitplane 5 (as indicated by shading).Bitplane 0 has coefficients only from the DD1 subband. As shown in Table8, both bitplanes 4 and 5 have coefficients from all subbands, so thepercentage is 100%, while bitplane 0 has only 25% of the coefficients(in the DD1 subband). As more decoding occurs, some bitplanes arecompleted before bitplane 0 is reached.

TABLE 8 Bits Required to Store LIC Coefficients While Decoding percentof coefficients bitplane bits/ in MSE alignment write read coefficientcontents (write/read) —* 5 1 tail-on  —/100% 5 4 2–3 tail-on, bit 5,sign? 100%/100% 4 3 3–4 tail-on, bits 4 . . . 5, sign? 100%/99%  3 2 4–5tail-on, bits 3 . . . 5, sign? 99%/96% 2 1 5–6 tail-on, bits 2 . . . 5,sign? 96%/82% 1 0 6–7 tail-on, bits 1 . . . 5, sign? 82%/25% 0 —† 7–8tail-on, bits 0 . . . 5, sign? 25%/—  *Witten during processing mostimportant chunk (MIC). †Read during inverse transform.

In Table 8, at the start of decoding, no decoding of bitplanes hasoccurred; therefore, only one bit (bit/coefficient) of every coefficientis read to determine if its a head or tail. As decoding continues, thenumber of bits per coefficient increases.

FIG. 33 shows how circular addressing can be used to handle writing datathat is larger than the data read. This occurs because the results ofthe processing produces more bits to write than were originally read.Referring to FIG. 33, the process begins by writing 1 bit percoefficient which is ⅛ of the memory space. Subsequently, 1 bit percoefficient is read, while 2–3 bits per coefficient are written. Then,the 2–3 bits per coefficient are read, while 3–4 bits per coefficientare written. This continues until all the data is done.

There are some options to simplify the hardware implementation. Insteadof always using the minimum number of bits, perhaps only 1, 2, 4, 6 or 8bits would be used which would cause one bit to be wasted for somesizes. Space for the sign bit could always be used, even if the sign bitwas not coded in the LIC or not known yet.

An option that would further reduce memory bandwidth would be to notstore the tail-on bit when it was not necessary. For example, whenwriting bitplane 0, there are 6 bits which are either head or tail bits.If any of these bits are non-zero, the tail-on must be true, and thereis no need to store the tail-on value, and the sign bit can be stored asthe seventh bit.

Memory bandwidth for the most important chunk (MIC) may also be reducedby variable length storage methods. Just using the minimum number ofbits instead of always using 8 bits per coefficient would result in asavings. Storing the 6-bit look ahead values (as in FIG. 15) instead ofzero coefficient bits would result in an even more efficient use ofmemory.

Reversible Color Space

The present invention provides for optionally performing reversiblecolor space conversion that allows converting between two color spacesso as to be completely reversible and implementable in integerarithmetic. That is, the color space data that is converted may bereversed to obtain all of the existing data regardless of any roundingor truncation that occurred during the forward conversion process.Reversible color spaces are described in U.S. patent application Ser.No. 08/436,662, entitled “Method and Apparatus for Reversible ColorConversion” filed May 8, 1995, and assigned to the corporate assignee ofthe present invention.

Color space conversions allow the advantages of an opponent color spacewithout sacrificing the ability to provide lossless results. For thelossless case, an opponent color space provides decorrelation thatimproves compression. For the lossy code, an opponent color space allowsluminance information to be quantized less than chrominance information,providing for higher visual quality. When a reversible color space isused with the transform of the present invention, properly embedding theluminance and chrominance coefficients is superior to subsampling forlossy compression, while still permitting lossless compression.

If a reversible color space is used, it is desirable to align thecoefficients such that the most significant bit of the 8-bit luminancecomponents and the 9-bit chrominance components have the same alignment.For lossy compression, this alignment causes chrominance data to bequantized twice as much as luminance data, and also allows for thepossibility of lossless compression for luminance and lossy (but veryhigh quality) compression for chrominance. Both of these results takeadvantage of characteristics of the Human Visual System.

Other Pixel Operations

Often a printer will have documents that are mostly or entirelynon-continuous. For example, text images with black and white only (0and 255 values only) may be common.

In one embodiment, the histogram of bands is completed. For example,0,255 black/white only images (the K component) can be remapped to 0,1images. Similar compactions can be made for spot color images. Note ifcompaction is used, compression must be lossless. However, the losslesscompression achieved is improved substantially when the compaction isperformed.

Alternatively, instead of using the overlapped wavelet transformsdescribed herein, binary and spot color images could be handled by alossless, bitplane based, JBIG-like context model.

In another alternate embodiment, the system may be designed to include abinary mode. FIG. 35 illustrate one embodiment of a binary context modelthat is similar to JBIG style context model template. Referring to FIG.35, shift registers 3501–3503 provide multiple bits per the JBIGstandard. Shift registers 3501 and 3502 receive second and first abovelines from line buffer 3500. The “above” lines provide the bitscorresponding to pixels in the northwest (NW), north (N), and northeast(NE) positions of the template, such as shown in FIG. 37. The outputs ofshift registers 3501 and 3502 are provided directly to context model3505. The output of shift register 3503 is provided to an optional mux3504 which can implement the adaptive template of the JBIG Standard.Context model 3505 is coupled to probability estimation machine 3506,which is in turn coupled to bit generator 3507. Context model 3505,probability estimation machine 3506, and bit generator 3507 operate in amanner well known in the art with respect to each other.

The output of mux 3504 in conjunction with the outputs of shift register3501 and 3502 and a feedback from the bit generator form the context binaddress used to address the context memory. In one embodiment, contextmemory 3505 includes 1,024 contexts with six bits to describe eachprobability state. This requires a context memory of 1,024 times sixbits.

Because the bit generator provides a decoded bit from the current lineas part of the context address, there is a large “bit to context” delayincluding the access time for the context memory.

FIG. 36 illustrates an alternative embodiment which utilizes the decodedbit from the current line to access the probability estimation machinein conjunction with a same address block 3601 which receives the outputsof shift register 3501 and 3502 and the output of multiplexor 3504. ThePEM 3506 receives the previous bit and uses it to select the proper oneout of the pair of context used. The selected context is updated, andboth contexts are written back to memory. The same address block 3601detects addresses that have already been read so that the data isalready in the probability estimation machine. The same address block3801 also sends the signal to use the data already in the PEM (which maybe updated data) instead of the stale information in memory.

In one embodiment, the decoder includes 1024 context bins with six bitsto describe each probability state. This requires the context memory of512 times 12 bits. The outputs of shift register 3501 and 3502 alongwith the output of multiplexor 3504 provide a partial context binaddress which only lacks the use of the previous bit. This results in aselection of a pair of context bins from context memory 3505. More thanone bit of a context bin can be excluded from the partial context. Eachmemory location contains 2^(n) probability states, where n is the numberof excluded bits.

It should be noted that the “bit to context” delay is reduced. Thecontext memory access can occur before the previous bit is decoded. Theprocessing of the PEM state for both states in a pair can begin inparallel before the previous bit is decoded. High speed operation can beachieved.

Encoder Rate Control

In addition to having the ability to quantize data, performing ratecontrol in the encoder also requires measuring the rate so thatdecisions on quantization can be made. If the rate indicates thatcompression is not good (i.e., not at a desired level), quantization maybe increased. On the other hand, if the rate indicates that compressionis too high, quantization may be decreased. Rate control decisions mustbe made identically in the encoder and the decoder.

One method of assuring that the encoder and decoder make the samedecisions is to use signaling. The encoder measures the rate atpredetermined internals and stores the quantization, Q, in memory forfuture use in the next interval. The decoder simply recalls thequantization from memory for each interval. This would require extramemory. For example, an on-chip SRAM with 256 locations of 2 bits (forindicating a change in Q by +2, +1, 0, −1 or for storing Q as 1,2,3,4)would be enough for changing quantization, Q, for every 16 lines for a4096 line image.

There are many options for rate measurement. FIG. 34 illustrates anencoder and decoder pair. Referring to FIG. 34, an encoder/decoder pairis shown containing context models (CM), probability estimationmodels/machines (PEM) and bit generators (BG), along with a run countreorder unit, interleaved word reorder unit and a shifter. Each of theseis well-known in the art. For a description, see U.S. Pat. Nos.5,381,145 and 5,583,500, assigned to the corporate assignees of thepresent invention and incorporated herein by reference.

The rate measurement must be explicit if the decoder cannot measure itat the same place. For instance, the rate measurement is provided to thedecoder as part of the compressed code stream, for example.

Another option for rate management illustrated as the smaller circle(position 2 in FIG. 34) is to count the start of interleaved words inthe encoder. In another embodiment, this is performed after the bitgeneration stage (position 4 in FIG. 34). Because the encoder anddecoder start a codeword at the same time, implicit signaling of therate may be used. The counting may be performed with counting hardwarethat comprises a register and an adder that adds the codeword lengthsand determines the average codeword length. Hardware to perform thecounting and determining average numbers of bits is well-known in theart and is shown in FIG. 34 as block 3401. It would be apparent thatthis block may be used to take similar measurements at other locationsin the system (e.g., positions 1, 2, 3, 4, on both encoder and decoder).

Other options would be to count the size of completed codewords afterthe bit generator, and before the interleaved word reorder unit(position 3 in FIG. 34), or to determine the amount of data actuallywritten to disk (position 1 in FIG. 34).

Rate measurement can be implicit: both the encoder and decoder performthe same rate determination calculation. For example, the encoder anddecoder could accumulate the average size of a codeword each time a newcodeword is started. This is represented by position 4 in FIG. 34. (Theactual size cannot be used, since the encoder does not know the sizeuntil the end of the codeword). If the R-codes used in the core vary insize from R2(0) through R2(7), the average codeword size varies from 1to 4.5 bits. If probability estimation works well, using the averageshould be very accurate. In other cases, the differences between theminimum and the maximum codeword lengths versus the average aretypically not so great, so the estimate should still be useful. Theaverage size of a Rz(k) codeword is k/2+1 bits.

The goal may be that in almost all cases the most important data willcompress well, and no quantization (Q=1) will be required. Only“pathological” images will require quantization (Q>1). Including thequantization feature, however, can guarantee that the system will notbreak on pathological images.

Another benefit of encoder rate control is that the encoding of lessimportant data can be stopped when the maximum bandwidth is exceeded.This increases the speed of encoding, and decreases the total time tooutput data (e.g., decrease the total time to print).

Keeping track of the effects of quantization changes (the value of Q) isimportant. For example, the definition of the largest coefficient in agroup of coefficients needs to be consistent when the quantizationchanges. Also, the reconstruction of quantized coefficients (whenbitplanes are discarded) needs to take into account the number ofdiscarded bitplanes for best results.

High-Speed Parallel Coding and Context Model

The entropy coding portion of the present invention comprises two parts.First, high-speed coding cores, operating in parallel, provideprobability estimation and bit generation. Second, a context modelprovides the contexts used for coding.

The number of cores required to achieve the desired speed is applicationdependent.

The other part of the entropy coding system is the context model for thecoefficients of the present invention. There are a large number oftrade-offs possible in implementing the context model. In oneembodiment, the present invention provides a context model with lowhardware cost that provides parallelism to support the use of thehigh-speed parallel coders of the present invention. Embodiments of thecontext model are described above.

Although only the context model for wavelet coefficients is describedherein, the present invention is not limited to context models that onlysupport wavelet coefficients. For instance, if a bitplane coding mode isdesired for binary or spot color images, an additional context model,such as described in U.S. patent application Ser. No. 08/642,518, filedMay 3, 1996 and entitled “Compression and Decompression with WaveletStyle and Binary Style Including Quantization by Device-DependentParser” and U.S. patent application Ser. No. 08/643,268, filed May 3,1996 and entitled “Compression/Decompression Using Reversible EmbeddedWavelets”, can be used.

Parallelism

In one embodiment, four high-speed coding cores are used toencode/decode eight bits per coefficient where coefficients range from 8to 12 bits (13 if a reversible color space is used). In one embodiment,a core is assigned to each of the four components, simplifyingparallelism and data flow. Each coefficient can use up to 16 cycles forencoding/encoding bits (including decisions for look-ahead, etc.).

The present invention maintains the cores for each component in sync,even if some cores are idle because of their successful look-ahead oranother core is handling a sign bit after a first “on” bit. The totaltime for running the context model will vary depending on the data,specifically the effectiveness of look-ahead, and to a lessor extent,the locations of first “on” bits.

Whereas many alterations and modifications of the present invention willno doubt become apparent to a person of ordinary skill in the art afterhaving read the foregoing description, it is to be understood that theparticular embodiment shown and described by way of illustration is inno way intended to be considered limiting. Therefore, references todetails of the various embodiment are not intended to limit the scope ofthe claims which in themselves recite only those features regarded asessential to the invention.

1. A method for decoding information in a codestream, the methodcomprising: generating contexts for bits in a compressed data stream;performing binary entropy decoding of bits in the compressed data streamto generate an embedded codestream of wavelet coefficients ordered withmore important data followed by less important data, including storingless important data coefficients with less bits than used to represent acoefficient that is to undergo application of a reversible inversetransform; and transforming coefficients into image data using areversible inverse wavelet filter.
 2. The method of claim 1 wherein theless important data comprises data bitplanes of a set of transformedcoefficients.
 3. The method defined in claim 1 wherein storing lessimportant data coefficients during binary entropy decoding comprises:reading a first amount of less important data from memory; and writing asecond amount of less important data greater than the first amount ofdata while reading the first amount of less important data to compensatefor transformed bitplanes with less data in the lower order bitplanes ofthe set of transformed coefficients.
 4. The method defined in claim 3wherein writing a second amount of less important data occurs inresponse to a write operation that is performed for each bit of eachcoefficient in the less important data.
 5. The method defined in claim 3wherein bits required to store the first amount of less important dataincrease as the number of biplanes being examined decreases.
 6. Anapparatus for decoding information in a codestream, the methodcomprising: means for generating contexts for bits in a compressed datastream; means for performing binary entropy decoding of bits in thecompressed data stream to generate an embedded codestream of waveletcoefficients ordered with more important data followed by less importantdata, including means for storing less important data coefficients withless bits than used to represent a coefficient that is to undergoapplication of a reversible inverse transform; and means fortransforming coefficients into image data using a reversible inversewavelet filter.
 7. The apparatus of claim 6 wherein the less importantdata comprises data bitplanes of a set of transformed coefficients. 8.The apparatus defined in claim 6 wherein the means for storing lessimportant data coefficients during binary entropy decoding comprises:means for reading a first amount of less important data from memory; andmeans for writing a second amount of less important data greater thanthe first amount of data while reading the first amount of lessimportant data to compensate for transformed bitplanes with less data inthe lower order bitplanes of the set of transformed coefficients.
 9. Theapparatus defined in claim 8 wherein the means for writing a secondamount of less important data operates in response to a write operationthat is performed for each bit of each coefficient in the less importantdata.
 10. The apparatus defined in claim 8 wherein bits required tostore the first amount of less important data increase as the number ofbiplanes being examined decreases.
 11. An article of manufacture havingone or more recordable media storing instructions thereon which, whenexecuted by a system, cause the system to decode information in acodestream by: generating contexts for bits in a compressed data stream;performing binary entropy decoding of bits in the compressed data streamto generate an embedded codestream of wavelet coefficients ordered withmore important data followed by less important data, including storingless important data coefficients with less bits than used to represent acoefficient that is to undergo application of a reversible inversetransform; and transforming coefficients into image data using areversible inverse wavelet filter.
 12. A method comprising: generatingcontexts for bits in a compressed data stream; performing binary entropydecoding of bits in the compressed data stream to generate an embeddedcodestream of wavelet coefficients ordered with more important datafollowed by less important data, wherein performing binary entropydecoding comprises reading a first amount of less important data frommemory, the less important data being less important portions of databitplanes of a set of transformed coefficients, and writing a secondamount of less important data greater than the first amount of lessimportant data while reading the first amount of less important data tocompensate for transformed bitplanes with less data in the lower orderbitplanes of the set of transformed coefficients; and transformingcoefficients into image data using a reversible inverse wavelet filter.13. The method defined in claim 12 further comprising storing thecoefficients bits of the less important data in packed bytes having lessbits than each number of bits used to represent coefficients.